Closed
Bug 193808
Opened 22 years ago
Closed 21 years ago
effective leak of nsDOMWindowController due to cycle with pref observer
Categories
(Core :: Disability Access APIs, defect)
Core
Disability Access APIs
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: jrgmorrison, Assigned: caillon)
References
()
Details
(Keywords: memory-leak)
I think this is effectively a leak. [I say effectively, because the destructor is eventually called at shutdown. However, this object should go away when its owning window is destroyed.] The use of AddObserver for |this| in the ctor now extends the life of the nsDOMWindowController to the life of the observer service which holds the pref branch. Are am I drinking too much coffee? Again. 6078 6079 nsDOMWindowController::nsDOMWindowController( nsIDOMWindowInternal *aWindow) 6080 { 6081 mWindow = aWindow; 6082 6083 // Set mBrowseWithCaret so we don't need to check pref every time 6084 mBrowseWithCaret = PR_FALSE; 6085 nsCOMPtr<nsIEventStateManager> esm; 6086 if (NS_SUCCEEDED(GetEventStateManager(getter_AddRefs(esm)))) 6087 esm->ResetBrowseWithCaret(&mBrowseWithCaret); 6088 6089 nsCOMPtr<nsIPrefBranchInternal> pbi(do_QueryInterface(gPrefBranch)); 6090 if (pbi) { 6091 pbi->AddObserver("accessibility.browsewithcaret", this, PR_FALSE); 6092 } 6093 } 6094 6095 nsDOMWindowController::~nsDOMWindowController() 6096 { 6097 nsCOMPtr<nsIPrefBranchInternal> pbi(do_QueryInterface(gPrefBranch)); 6098 if (pbi) { 6099 pbi->RemoveObserver("accessibility.browsewithcaret", this); 6100 } 6101 } 6102
Comment 1•22 years ago
|
||
Yeah, that's a leak....
Assignee | ||
Comment 2•22 years ago
|
||
Attachment 108171 [details] [diff] (from bug 183069) should fix this I think. It already has r=timeless, sr=bzbarsky.
Assignee | ||
Comment 4•21 years ago
|
||
I don't believe this is any longer an issue due to the checkins from bug 201560.
Assignee | ||
Comment 5•21 years ago
|
||
Closing. If this still seems to be a problem, then re-open it.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•