Bug 34903 - Workers' EventListeners should be removed before JSGlobalData is destroyed
Summary: Workers' EventListeners should be removed before JSGlobalData is destroyed
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Gavin Barraclough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-12 13:47 PST by Gavin Barraclough
Modified: 2010-02-12 14:42 PST (History)
1 user (show)

See Also:


Attachments
The patch (4.58 KB, patch)
2010-02-12 13:49 PST, Gavin Barraclough
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin Barraclough 2010-02-12 13:47:06 PST
Since http://trac.webkit.org/changeset/54460 the EventListeners registered by a worker thread are not removed until after the thread's JSGlobalData has been destroyed.  This is slightly worrisome since the JSEventListener contains JSObject*s, which will be dangling once the heap is destroyed.  The JSEventListeners may also reference the worker thread's normal world, which again it makes no sense to keep around after the JSGlobalData is freed.

remove all event listeners immediately prior to tearing down the JSGlobalData.

https://bugs.webkit.org/show_bug.cgi?id=34728 addressed the symptoms of this problem, and it is probably cleaner to make the client data's normal world no longer be a member (since it is a ref-counted object), however they should be no requirement to 'detatch' – it makes no sense for anyone to be referencing the world after the JSGlobalData has gone away (the world's purpose is to hold wrapper objects in the JSGlobalData's heap).  Keep the restructuring that makes the normal world no longer be a member, but remove the detach mechanism this patch added & replace with stronger ASSERTs.
Comment 1 Gavin Barraclough 2010-02-12 13:49:23 PST
Created attachment 48662 [details]
The patch
Comment 2 Gavin Barraclough 2010-02-12 14:42:56 PST
fixed in r54740