Closed Bug 107585 Opened 23 years ago Closed 23 years ago

nsPrefBranch calls getService on shutdown; should register shutdown listener

Categories

(Core :: Preferences: Backend, defect)

x86
Windows NT
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: depman1, Assigned: bnesse)

References

Details

Attachments

(1 file)

reproduced with 10/27 debug mozilla nightly build. 1. Set breakpoint in nsComponentManager.cpp: line 2075 2. Launch app in the debugger (F5). 3. Quit the app. 4. Check the stack trace. 5. Press F5 to advance debugger until you see ~nsPrefBranch in stack trace. Then doubleclick on destructor line Result: ~nsPrefBranch() calls do_GetService Expected: Should register shutdown listener. Here's the source of the destructor: nsPrefBranch::~nsPrefBranch() { freeObserverList(); nsCOMPtr<nsIObserverService> observerService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID); if (observerService) observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID); }
this results in warning msg when mozilla is shutdown (bug 107391)
Depends on: 107391
ironically it looks like we're just removing ourselves as a startup observer the better choice would be to just make prefs add itself as a weak listener, and then remove all this stuff at the end.
-> Preferences: Backend
Assignee: sgehani → bnesse
Component: Preferences → Preferences: Backend
Actually we already are added as a weak reference. All we have to do is not remove ourselves.
Status: NEW → ASSIGNED
Comment on attachment 55786 [details] [diff] [review] Patch to not remove observer looks good.
Attachment #55786 - Flags: review+
Comment on attachment 55786 [details] [diff] [review] Patch to not remove observer sr=alecf
Attachment #55786 - Flags: superreview+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
verified with 11/2 nightly mozilla build. Removed the observer remover from nsPrefBranch.cpp. nsPrefBranch destructor no longer appearing in the stack track
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: