Closed Bug 507255 Opened 15 years ago Closed 15 years ago

Fragment::onDestroy can cause double-deletes

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: stejohns, Unassigned)

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
Fragment::onDestroy is called exclusively from ~Fragment.

Since Fragment is a GCFinalizedObject, this means that
it is called only if:
	(a) the heap is being swept, or
	(b) we have been explicitly deleted. 

HOWEVER: LirBuffer is also a GCFinalizedObject.

Thus, for case (a), lirbuf might have been finalized before
us, so we MUST NOT explicitly delete it here, because that
could cause a double-delete, which can lead to many amusing problems.

Instead, we will do nothing here, and in the (rare) case (b), 
lirbuf will simply be collected in due course.
Attachment #391456 - Flags: superreview?(edwsmith)
Attachment #391456 - Flags: review?(rreitmai)
Comment on attachment 391456 [details] [diff] [review]
Patch

Fine for now since mem mgt is being reworked in bug #506390

You might want to set lirbuf = 0 in the onDestroy to help the gc out a bit.
Attachment #391456 - Flags: review?(rreitmai) → review+
pushed (with suggested change) as changeset:   2271:c62fa72c6344
Comment on attachment 391456 [details] [diff] [review]
Patch

onDestroy() is slated for gutting anyway with upcoming changes that turn Fragment and LirBuffer into arena-allocated objects.
Attachment #391456 - Flags: superreview?(edwsmith) → superreview+
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Resolved fixed engineering / work item that has been pushed.  Setting status to verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: