Closed
Bug 59135
Opened 24 years ago
Closed 24 years ago
nsSystemPrincipal confuses the refcount logging
Categories
(Core :: Security: CAPS, defect, P3)
Tracking
()
VERIFIED
FIXED
mozilla0.9
People
(Reporter: dbaron, Assigned: dbaron)
Details
Attachments
(2 files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review |
nsSystemPrincipal confuses the XPCOM refcount logging tools, which end up
indicating a refcount of -1, adding noise to the leak stats. This is because
nsDestroyJSPrincipals adds to the refcount manually and releases using Release()
to delete the object.
The reason for this whole issue is that a single refcount is used for both JS
and XPCOM. If the refcount hits zero through a JS release, then
nsDestroyJSPrincipals is called, whereas if it hits zero through an XPCOM
release, then the object is destroyed by its Release method. If the last
release comes through XPCOM, then things are fine, but if the last release comes
through JS, then the XPCOM logging is confused because nsDestroyJSPrincipals
does one more release than addref. Changing the refcount++ in
nsDestroyJSPrincipals to a real AddRef didn't seem to work when I tried it
before -- I need to investigate more why not, since I think this is the real fix.
I have a hack that works when both the first addref and the last release come
from JS, which seems to be the case currently. However, I don't like it.
Assignee | ||
Comment 1•24 years ago
|
||
Assignee | ||
Comment 2•24 years ago
|
||
Aha. The reason the AddRef didn't work was because the leak logging considers
AddRef-to-1 special, just like it considers Release-to-0 special. So there's a
sneaky fix that's much cleaner, about to be attached...
Assignee | ||
Comment 3•24 years ago
|
||
Assignee | ||
Updated•24 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
Comment 4•24 years ago
|
||
Looks good to me, r=mstoltz.
Comment 5•24 years ago
|
||
Sleazy, but WIB. sr=brendan@mozilla.org.
/be
Assignee | ||
Comment 6•24 years ago
|
||
Fix checked in 2000-11-07 19:06 PDT.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•