Changeset 35815 in webkit for trunk/JavaScriptCore/API/JSContextRef.cpp
- Timestamp:
- Aug 18, 2008, 1:09:59 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSContextRef.cpp
r35663 r35815 82 82 { 83 83 ExecState* exec = toJS(ctx); 84 exec->globalData().heap->registerThread(); 84 JSGlobalData& globalData = exec->globalData(); 85 86 globalData.heap->registerThread(); 85 87 86 88 gcProtect(exec->dynamicGlobalObject()); 89 globalData.ref(); 87 90 return ctx; 88 91 } … … 95 98 96 99 JSGlobalData& globalData = exec->globalData(); 97 if (globalData.refCount() == 1) {100 if (globalData.refCount() == 2) { // One reference is held by JSGlobalObject, another added by JSGlobalContextRetain(). 98 101 // The last reference was released, this is our last chance to collect. 99 102 Heap* heap = globalData.heap; … … 102 105 ASSERT(!heap->isBusy()); 103 106 104 // Heap destructor will delete JSGlobalObject, which will in turn delete JSGlobalData, which will 105 // delete the heap, which would cause a crash if allowed. 107 delete heap; 106 108 globalData.heap = 0; 109 } 107 110 108 delete heap; 109 } 111 globalData.deref(); 110 112 } 111 113
Note:
See TracChangeset
for help on using the changeset viewer.