[Webkit-unassigned] [Bug 67906] New: Use of static RefPtr in FontPlatformData causes global destructor ordering problems

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Sep 11 14:13:34 PDT 2011


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

           Summary: Use of static RefPtr in FontPlatformData causes global
                    destructor ordering problems
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows 7
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebCore Misc.
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: marshall at chromium.org
                CC: abarth at webkit.org


>From WebKit/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp:

FontPlatformData::RefCountedHFONT* FontPlatformData::hashTableDeletedFontValue()
{
    static RefPtr<RefCountedHFONT> deletedValue =
        RefCountedHFONT::create(reinterpret_cast<HFONT>(-1));
    return deletedValue.get();
}

The problem with using static RefPtr is that, on Windows, the destructor of |deletedValue| will not be called until doexit() is executed on the main application thread. In single-process applications (like Chromium Embedded Framework) the main application thread may not be the same as the WebKit thread. This problem was exposed by WebKit revision 92254 which adds asserts to RefCounted to make sure ref/deref happens on the right thread.

According to the WebKit experts the correct solution is to intentionally leak the static RefCountedHFONT object using leakRef().

-- 
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