Closed
Bug 627938
Opened 14 years ago
Closed 14 years ago
Bad call to nsGlobalChromeWindow::CleanUp causes segfault
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
blocking2.0 | --- | - |
People
(Reporter: cdleary, Assigned: cdleary)
Details
(Keywords: crash)
Attachments
(2 files, 1 obsolete file)
4.95 KB,
text/plain
|
Details | |
3.40 KB,
patch
|
smaug
:
review+
jst
:
approval2.0+
|
Details | Diff | Splinter Review |
CleanUp is called from the nsGlobalWindow destructor, after the more-derived nsGlobalChromeWindow destructor has been called, but the mMessageManager->Disconnect() used from the nsGlobalWindow destructor is part of the nsGlobalChromeWindow.
1120 if (mIsChrome && static_cast<nsGlobalChromeWindow*>(this)->mMessageManager) {
1121 static_cast<nsFrameMessageManager*>(
1122 static_cast<nsGlobalChromeWindow*>(
1123 this)->mMessageManager.get())->Disconnect();
1124 }
As mrbkap points out, the CleanUp code is called from multiple places, so there should be a flag passed to indicate whether the nsGlobalChromeWindow bits have already been destroyed.
Assignee | ||
Updated•14 years ago
|
blocking2.0: --- → ?
Assignee | ||
Comment 1•14 years ago
|
||
No longer segfaults on my box.
Attachment #506027 -
Flags: review?
Assignee | ||
Updated•14 years ago
|
Attachment #506027 -
Flags: review? → review?(mrbkap)
Comment 2•14 years ago
|
||
Comment on attachment 506027 [details] [diff] [review]
Fix chrome window destructor.
I think jst should actually review this.
Attachment #506027 -
Flags: review?(mrbkap) → review?(jst)
Comment 3•14 years ago
|
||
I wonder if calling CleanUp() in the nsGlobalChromeWindow dtor wouldn't be a more correct fix here, calling it from there would mean that the call in the nsGlobalWindow dtor would return early, before we hit the bad cast. Smaug, any thoughts? Chris, does that fix this issue for you (assuming you can reproduce)?
I'd be happy to take the attached fix for now if we deem anything else has too many non-obvious side effects, but it *seems* fine to me to call CleanUp() from the nsGlobalChromeWindow dtor.
Comment 4•14 years ago
|
||
Hmm, setting mIsChrome to false is error prone, I think.
Though, so is the whole CleanUp handling.
Could you just add a boolean flag to nsGlobalWindow to indicate if
message manager needs to be disconnected. Then set it true when
messageManager is created, and false when disconnected.
And also disconnect in chromewindow dtor.
A bit ugly, but should be quite safe. And that is what we need at this point,
IMO.
And yes, this all is my fault :(
Assignee | ||
Comment 5•14 years ago
|
||
I can confirm that this avoids the crash when I get back to my machine in the office, but seeing as how the other fix worked, I'm pretty sure we have the issue nailed down.
Attachment #506027 -
Attachment is obsolete: true
Attachment #506157 -
Flags: review?(Olli.Pettay)
Attachment #506027 -
Flags: review?(jst)
Comment 6•14 years ago
|
||
Comment on attachment 506157 [details] [diff] [review]
Clean manager flag.
Btw, after FF4 we should probably change GlobalWindow deletion to be closer to
what happens with DOM Nodes - dtor is in general rather dummy, but
most of the clean up happens in LastRelease.
There is a reason why we have
NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS_WITH_DESTROY macro.
Attachment #506157 -
Flags: review?(Olli.Pettay) → review+
Comment 7•14 years ago
|
||
Comment on attachment 506157 [details] [diff] [review]
Clean manager flag.
Not knowing how and when this is triggered I can't say I think this blocks, but I'd love to see this patch land for 2.0 either way.
Attachment #506157 -
Flags: approval2.0+
Updated•14 years ago
|
blocking2.0: ? → -
Assignee | ||
Comment 8•14 years ago
|
||
(In reply to comment #7)
> Not knowing how and when this is triggered I can't say I think this blocks, but
> I'd love to see this patch land for 2.0 either way.
Not sure why this was burning tip mochitests on my box but nobody else's... destructor order should be deterministic and destructing the subclass parts will always create invalid-memory-pattern on debug builds? I must be missing something.
Pushing to try, just to make sure it comes up as green as the last patch!
Assignee: nobody → cdleary
Status: NEW → ASSIGNED
Assignee | ||
Comment 9•14 years ago
|
||
I forgot I had already pushed that patch to try and it went green -- here's the checkin: http://hg.mozilla.org/mozilla-central/rev/c16db7731c12
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•