Ignore:
Timestamp:
Jan 5, 2009, 10:13:05 AM (16 years ago)
Author:
[email protected]
Message:

Reviewed by Darin Adler.

https://bugs.webkit.org/show_bug.cgi?id=23073
<rdar://problem/6471129> Workers crash on Windows Release builds

JavaScriptCore:

  • wtf/ThreadSpecific.h: (WTF::ThreadSpecific::destroy): Changed to clear the pointer only after data object destruction is finished - otherwise, WebCore::ThreadGlobalData destructor was re-creating the object in order to access atomic string table. (WTF::ThreadSpecific::operator T*): Symmetrically, set up the per-thread pointer before data constructor is called.
  • wtf/ThreadingWin.cpp: (WTF::wtfThreadEntryPoint): Remove a Windows-only hack to finalize a thread - pthreadVC2 is a DLL, so it gets thread detached messages, and cleans up thread specific data automatically. Besides, this code wasn't even compiled in for some time now.

WebCore:

  • platform/ThreadGlobalData.cpp: (WebCore::ThreadGlobalData::ThreadGlobalData):
  • platform/ThreadGlobalData.h: (WebCore::ThreadGlobalData::eventNames): Now that ThreadSpecific sets up the pointer before invoking data constructor, we can initialize EventNames right away.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/ThreadSpecific.h

    r35194 r39604  
    9898{
    9999    Data* data = static_cast<Data*>(ptr);
     100    data->value->~T();
     101    fastFree(data->value);
     102    // Only reset the pointer after value destructor finishes - otherwise, code in destructor could trigger
     103    // re-creation of the object.
    100104    pthread_setspecific(data->owner->m_key, 0);
    101     delete data->value;
    102105    delete data;
    103106}
     
    112115    T* ptr = static_cast<T*>(get());
    113116    if (!ptr) {
    114         ptr = new T();
     117        // Set up thread-specific value's memory pointer before invoking constructor, in case any function it calls
     118        // needs to access the value, to avoid recursion.
     119        ptr = static_cast<T*>(fastMalloc(sizeof(T)));
    115120        set(ptr);
     121        new (ptr) T;
    116122    }
    117123    return ptr;
Note: See TracChangeset for help on using the changeset viewer.