Closed Bug 377899 Opened 17 years ago Closed 17 years ago

Cycle between nsXULTooltipListener and nsGlobalWindows causes leaks

Categories

(Core :: XUL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: peterv, Assigned: smaug)

References

Details

(Keywords: memory-leak)

Attachments

(3 files)

Attached file Testcase
See bug 376802, comment 11 and others. In the attached testcase, hover over the button and the browser will quit, leaking nsGlobalWindows (the first time you'll need to allow UniversalXPConnect privileges). It shows one way to keep a nsGlobalWindow alive, I'll also attach part of an ownership graph.
Attached image Onwership graph
The missing edge to nsXULTooltipListener comes from nsLayoutStatics (which keeps it because there are live nsGlobalWindows).
The tooltiplistener keeps a strong reference to the tooltip as long as the tooltip is shown, so waiting for a popuphiding event that never comes. I assume before bug 376802 the tooltip listener would have been destroyed when the source element was unbound from the tree, thus releasing the reference to the tooltip?
Assignee: neil → Olli.Pettay
Status: NEW → ASSIGNED
Attachment #262751 - Flags: review?(neil)
Attachment #262751 - Flags: superreview?(peterv)
Comment on attachment 262751 [details] [diff] [review]
using cycle collector, v1

That should work, yes.
Attachment #262751 - Flags: superreview?(peterv) → superreview+
Comment on attachment 262751 [details] [diff] [review]
using cycle collector, v1

>-
>-  // nsISupports
>-  NS_DECL_ISUPPORTS
>+  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
>+  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULTooltipListener,
>+                                           nsIDOMMouseListener)
> 
>   // nsIDOMMouseListener
Nit: any reason why you removed the nsISupports comment?
Attachment #262751 - Flags: review?(neil) → review+
Because NS_DECL_CYCLE_COLLECTING_*** does something else too, not only
declares nsISupports.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
Keywords: mlk
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: