[Webkit-unassigned] [Bug 119070] New: Introduce RecursionGuard to prevent recursive calls to a function

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 24 17:58:38 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=119070

           Summary: Introduce RecursionGuard to prevent recursive calls to
                    a function
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Template Framework
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: skyul at company100.net


A common pattern to prevent recursion calls to a function is

void Foo::bar()
{
    ASSERT(!m_inBar);
    m_inBar = true;

    ...

    m_inBar = false;
}

We can abstract this pattern into RecursionGuard, which is more convenient because it automatically asserts if the flag is false before setting it to true, and resets the flag to false in the destructor (RAAI).

void Foo::bar()
{
    RecursionGuard guard(m_inBar);

    ...
}

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list