Closed Bug 379727 Opened 16 years ago Closed 16 years ago

JavaMember should define trace/mark instead of using AddNamedRoot

Categories

(Core Graveyard :: Java: Live Connect, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: igor, Assigned: igor)

Details

Attachments

(1 file, 1 obsolete file)

Currently js/src/liveconnect/jsj_JavaMember.c defines JavaMember JS class that use explicit AddNamedRoot/RemoveRoot API for managing its roots with RemoveRoot called from the finalizer.

Besides being eneficient, this can lead to leak when a JS object is stored inside Java entity. So the class should implement the standard trace/mark method instead.
Attached patch fix v1 (obsolete) — Splinter Review
The patch implements the trace method to replace explicit root management.
Attachment #263733 - Flags: superreview?(alfred.peng)
Attachment #263733 - Flags: review?(brendan)
Comment on attachment 263733 [details] [diff] [review]
fix v1

sr=me contingent upon r=alfred, since alfred is not an SR and is indeed the module owner.

/be
Attachment #263733 - Flags: superreview?(alfred.peng)
Attachment #263733 - Flags: superreview+
Attachment #263733 - Flags: review?(brendan)
Attachment #263733 - Flags: review?(alfred.peng)
Attached patch fix v2Splinter Review
In the previous patch I missed the fact that class prototype instance of JavaMember does not have private data so the trace must check for that. When I build a browser with liveconnect enabled, it exposed the problem instantly.
Attachment #263733 - Attachment is obsolete: true
Attachment #263920 - Flags: superreview?(brendan)
Attachment #263920 - Flags: review?(alfred.peng)
Attachment #263733 - Flags: review?(alfred.peng)
Comment on attachment 263920 [details] [diff] [review]
fix v2

Oops, I should have seen that one coming...

/be
Attachment #263920 - Flags: superreview?(brendan) → superreview+
Comment on attachment 263920 [details] [diff] [review]
fix v2

Looks fine for me. Thanks for the patch. r=alfred.
Attachment #263920 - Flags: review?(alfred.peng) → review+
I committed the patch from comment 3 to the trunk:

Checking in liveconnect/jsj_JavaMember.c;                                                                                                                          
/cvsroot/mozilla/js/src/liveconnect/jsj_JavaMember.c,v  <--  jsj_JavaMember.c                                                                                      
new revision: 1.18; previous revision: 1.17                                                                                                                        
done                                                                                                                                                       
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.