Closed Bug 1480624 Opened 6 years ago Closed 6 years ago

Run complex type destructors in xpconnect

Categories

(Core :: XPConnect, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: nika, Assigned: nika)

References

Details

Attachments

(2 files)

XPConnect currently handles UntypedTArray objects by clearing them to an EmptyHdr() state, and then simply dropping the memory. Unfortunately, this doesn't work with our leakchecker, as it increments a counter in the constructor, and then the destructor is never run.

These patches cause XPConnect to run destructors for complex types before freeing backing memory.
This macro simplifies code which allows performing an operation on or
extracting information from a particular nsXPTType's native representation.

It is also used in part 2 to implement xpc::DestructValue.
DestructValue acts a lot like CleanupValue, however in addition to normal
cleanup work, it invokes the destructor of complex data types. This is important
to ensure that constructors and destructors are matched for these complex data
types.

CleanupValue is also used to clean up a value without destructing it, so cannot
be modified in-place.

Depends On D2689
Comment on attachment 8997221 [details]
Bug 1480624 - Part 1: Add XPT_FOR_EACH_*_TYPE macros to xptinfo.h, r=mccr8

Andrew McCreight [:mccr8] (away Aug 6 - 10) has approved the revision.

https://phabricator.services.mozilla.com/D2689
Attachment #8997221 - Flags: review+
Comment on attachment 8997223 [details]
Bug 1480624 - Part 2: Add a DestructValue method to XPConnect to run XPT Type destructors, r=mccr8

Andrew McCreight [:mccr8] (away Aug 6 - 10) has approved the revision.

https://phabricator.services.mozilla.com/D2690
Attachment #8997223 - Flags: review+
Priority: -- → P2
Pushed by nika@thelayzells.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6c314f9378ad
Part 1: Add XPT_FOR_EACH_*_TYPE macros to xptinfo.h, r=mccr8
https://hg.mozilla.org/integration/mozilla-inbound/rev/8376dfb0af82
Part 2: Add a DestructValue method to XPConnect to run XPT Type destructors, r=mccr8
https://hg.mozilla.org/mozilla-central/rev/6c314f9378ad
https://hg.mozilla.org/mozilla-central/rev/8376dfb0af82
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Depends on: 1481005
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: