Closed
Bug 18682
Opened 26 years ago
Closed 26 years ago
Observer service should not hold strong references
Categories
(Core :: XPCOM, defect, P1)
Tracking
()
RESOLVED
FIXED
M13
People
(Reporter: dp, Assigned: scc-obsolete)
Details
Currently the observerservice seems to hold a strong reference to the
nsIObservers thereby influencing their lifetime.
It should change to hold weak refs.
I dont think many are counting on it to maintain lifetime. Some stuff in
extensions/ like wallet and cookies might. We need to check before doing the
conversion.
Assignee | ||
Updated•26 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Updated•26 years ago
|
Target Milestone: M12
Assignee | ||
Comment 1•26 years ago
|
||
I think this is a very important bug. The current bad ownership model is killing
us. We need to fix this is a soon as possible. Marking M12.
Assignee | ||
Updated•26 years ago
|
Priority: P3 → P1
Assignee | ||
Comment 2•26 years ago
|
||
The code for this is all checked in ...but I don't want to turn this facility
`on' until I fix the two remaining bugs. Wallet observer service needs to hang
from something. Someone is registering an observer that does not support weak
references. If I turn this on before fixing these, the world becomes annoying
for users. This two minimal bug fixes should be no problem during M12
stabilization.
Comment 3•26 years ago
|
||
scott, what is the progress?
Reporter | ||
Comment 4•26 years ago
|
||
Scott has fixes for this ready to go. I have reviewed it. We are waiting on your
approval.
Reporter | ||
Updated•26 years ago
|
Target Milestone: M12 → M13
Reporter | ||
Comment 5•26 years ago
|
||
We will fix this for M13 after some renewed discussions.
Comment 6•26 years ago
|
||
I see a checkin in nsWalletService.cpp line 51 that says:
1.43 <scc@netscape.com> 14 Dec 1999 10:51
Make observers support weak references. Wallet service needs refcount
stabilization in constructor to avoid premature release. Bug #18682; r=dp.
a=dp.
This fix breaks the leak/bloat stats on tinderbox, making the nsTraceRefcnt
system think it's getting decremented to -1. It seems bogus to me that Init
should destroy the service prematurely. Let's find another way to do this.
Comment 7•26 years ago
|
||
Here's what's happening: The way the NS_ADDREF macro (and nsTraceRefcnt) stuff
works is that it counts the first addref of an object as its construction and
increments the construction count. It knows it's the first addref by looking at
the refcnt. But in this case, the refcnt is already at 1, and it the first
NS_ADDREF gets called in the Init method incrementing it to 2, so it never
notices the construction. Then later it notices the destruction and says that
-1 objects of that class are still in existence.
What do we do?... I think calling Init from the constructor is bogus because
everything that it does can fail. If Init was was an interface method that was
called from elsewhere, 2 good things would happen: the errors from Init could
be detected, and the refcount stuff wouldn't get screwed up.
I'm not sure where Init should go though (perhaps in main1, nsAppRunner.cpp
line 604, before the WALLET_FetchFromNetCenter call).
Assignee | ||
Updated•26 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 8•26 years ago
|
||
Well, this is all checked in and working. Everything seems fine 2 weeks later.
Marking fixed.
You need to log in
before you can comment on or make changes to this bug.
Description
•