Closed Bug 502055 Opened 15 years ago Closed 15 years ago

XBL leaks

Categories

(Core :: XBL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: peterv, Assigned: peterv)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch v1 (obsolete) — Splinter Review
If an element with a binding doesn't have a parent, we won't unlink it because we currently rely on a parent to do that by calling Unbind on its children.
If an element with a binding doesn't have an owner document anymore, we won't unlink it because we can't get at the binding from the element.
Comment on attachment 386585 [details] [diff] [review]
v1

>diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp
>--- a/content/base/src/nsGenericElement.cpp
>+++ b/content/base/src/nsGenericElement.cpp
>@@ -3987,8 +3987,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
>         NS_IF_RELEASE(slots->mControllers);
>       slots->mChildrenList = nsnull;
>     }
>   }
>+
>+  {
>+    nsIDocument *doc;
>+    if (!tmp->GetNodeParent() && (doc = tmp->GetOwnerDoc()) &&
>+        tmp->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
>+      nsAutoScriptBlocker scriptBlocker;
>+      doc->BindingManager()->ChangeDocumentFor(tmp, doc, nsnull);
>+    }
>+  }
> NS_IMPL_CYCLE_COLLECTION_UNLINK_END
Scriptblocker in unlink? Very scary. Does ChangeDocumentFor really need it?
Perhaps the scriptblocker could be set before calling cycle collector?
Attached patch v1.1Splinter Review
Yeah, I don't think it needs a script blocker.
Attachment #386585 - Attachment is obsolete: true
Attachment #386746 - Flags: superreview?(bzbarsky)
Attachment #386746 - Flags: review?(Olli.Pettay)
Attachment #386746 - Flags: superreview?(bzbarsky) → superreview+
Comment on attachment 386746 [details] [diff] [review]
v1.1

Looks ok.  Does this fix those addBinding leaks we were seeing on mochitest, perchance?
Attachment #386746 - Flags: review?(Olli.Pettay) → review+
http://hg.mozilla.org/mozilla-central/rev/fe1f520ff772

I'll try to make a testcase, but it could be hard (dependent on order of CC or GC).
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: