Closed
Bug 334605
Opened 19 years ago
Closed 19 years ago
balsa orange due to atom table shutdown code
Categories
(Core :: XPCOM, defect, P1)
Tracking
()
RESOLVED
FIXED
mozilla1.8.1alpha2
People
(Reporter: dbaron, Assigned: dbaron)
References
Details
(Keywords: fixed1.8.1, Whiteboard: [patch])
Attachments
(1 file)
3.35 KB,
patch
|
mrbkap
:
review+
brendan
:
superreview+
dbaron
:
approval-branch-1.8.1+
|
Details | Diff | Splinter Review |
Balsa is orange due to the assertions added in bug 334180, due to a bug in the atom table shutdown code that I wrote (perhaps compiler-bug-sensitive). Calling virtual functions in the destructor of a base class isn't (IIRC) guaranteed or even supposed to call the function on the derived class. (mrbkap, is that right?)
In any case, the following patch makes IsPermanent non-virtual so that it doesn't fire in the destructor. This is actually a pretty nasty bug.
Assignee | ||
Comment 1•19 years ago
|
||
Attachment #218957 -
Flags: superreview?(brendan)
Attachment #218957 -
Flags: review?(mrbkap)
Attachment #218957 -
Flags: approval-branch-1.8.1?(brendan)
Assignee | ||
Updated•19 years ago
|
Status: NEW → ASSIGNED
Flags: blocking1.8.1?
Priority: -- → P1
Whiteboard: [patch]
Target Milestone: --- → mozilla1.8.1alpha2
Assignee | ||
Comment 2•19 years ago
|
||
(That said, I'm honestly not sure what code still uses permanent atoms.)
Comment 3•19 years ago
|
||
Comment on attachment 218957 [details] [diff] [review]
patch
- Index: nsAtomTable.cpp
>+PermanentAtomImpl::PermanentAtomImpl()
>+ : AtomImpl()
Why bother calling the default constructor by hand?
I'm not sure what the C++ standard has to say about this, but it seems like calling virtual functions from a base class' destructor is asking for trouble since the more derived class' destructor has already run.
Attachment #218957 -
Flags: review?(mrbkap) → review+
Assignee | ||
Comment 4•19 years ago
|
||
(In reply to comment #3)
> Why bother calling the default constructor by hand?
AIX had trouble with it at one point and it doesn't hurt?
Comment 5•19 years ago
|
||
Comment on attachment 218957 [details] [diff] [review]
patch
rs=me.
/be
Attachment #218957 -
Flags: superreview?(brendan) → superreview+
Assignee | ||
Comment 6•19 years ago
|
||
Checked in to trunk, 2006-04-19 14:46 -0700.
(But not 1.8 branch yet.)
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 7•19 years ago
|
||
Comment on attachment 218957 [details] [diff] [review]
patch
brendan gave verbal approval-branch-1.8.1
Attachment #218957 -
Flags: approval-branch-1.8.1?(brendan) → approval-branch-1.8.1+
![]() |
||
Comment 9•19 years ago
|
||
> (That said, I'm honestly not sure what code still uses permanent atoms.)
The only non-test code in mozilla.org cvs on trunk that does is the code that runs when someone registers a static atom with the same name as an already-existing (in the table) non-static atom. We call PromoteToPermanent in that case. If we figured out a different way to do that, we could nix permanent atoms. We should consider nixing them from nsIAtom and nsIAtomService in any case....
This patch is actually threadsafe.
If thread A calls addref or release on an atom at the same time as thread B calls PromoteToPermanent, there's a risk that thread B will set mRefCnt to REFCNT_PERMANENT_SENTINEL and then thread A increases or decreases it by one.
Note that thread A doesn't necessarily have to be in addref/release, it might just have read the vtable pointer but not called the function yet.
This problem didn't used to exist since it didn't matter if the refcount was modified a bit from other threads even after the atom was marked permanent.
Assignee | ||
Comment 11•19 years ago
|
||
Filed bug 335734 on threadsafety problems.
You need to log in
before you can comment on or make changes to this bug.
Description
•