Closed
Bug 70160
Opened 23 years ago
Closed 23 years ago
viewer crash at exit gBrowsers == NULL
Categories
(Core Graveyard :: Viewer App, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: bernd_mozilla, Assigned: attinasi)
Details
Attachments
(1 file)
548 bytes,
patch
|
Details | Diff | Splinter Review |
steps:
start viewer.exe
exit via menu
crash
solution (quick hack)
Index: nsBrowserWindow.cpp
===================================================================
RCS file: /cvsroot/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp,v
retrieving revision 3.350
diff -r3.350 nsBrowserWindow.cpp
583a584,585
> if(!gBrowsers)
> return;
It does not look nice but it fixes the annoying crash
Win98 CVS 2001-02-25
this bug was introduced by dbaron with his fix for bug 70004. The problem is that bw->destroy calls RemoveBrowser an there if (!gBrowsers->Count()) { delete gBrowsers; gBrowsers = nsnull; If gBrowser->Count is 1 then we will first remove an element, then we will recognize in RemoveBroser that we dont have any more elements and destroy gBrowsers, but we query query gBrowsers->Count and it crashes. Adding David to CC. With the proposed patch one could also remove the follwong lines from CloseAllWindows. delete gBrowsers; gBrowsers = nsnull; patch follows
Maybe it would be better to just change the condition of the while loop to |while (gBrowsers && gBrowsers->Count())|, and remove the null check from the beginning?
Proposed patch: Index: nsBrowserWindow.cpp =================================================================== RCS file: /cvsroot/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp,v retrieving revision 3.350 diff -u -d -r3.350 nsBrowserWindow.cpp --- nsBrowserWindow.cpp 2001/02/24 17:15:50 3.350 +++ nsBrowserWindow.cpp 2001/02/27 03:30:55 @@ -574,16 +574,16 @@ void nsBrowserWindow::CloseAllWindows() { - if (!gBrowsers) - return; - while (0 != gBrowsers->Count()) { + while (gBrowsers && gBrowsers->Count()) { nsBrowserWindow* bw = (nsBrowserWindow*) gBrowsers->ElementAt(0); NS_ADDREF(bw); bw->Destroy(); NS_RELEASE(bw); } - delete gBrowsers; - gBrowsers = nsnull; + if (gBrowsers) { + delete gBrowsers; + gBrowsers = nsnull; + } } static nsEventStatus PR_CALLBACK
Comment 5•23 years ago
|
||
Patch looks fine to me, r=jst
OK, I checked in my version of the patch at 2001-02-26 19:26 PST. Thanks, Bernd, for reporting this and figuring out the problem.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
er, 19:46 PST.
Updated•16 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•