All users were logged out of Bugzilla on October 13th, 2018

[FIX]Viewer leaking widgets

RESOLVED FIXED in M15

Status

P3
normal
RESOLVED FIXED
19 years ago
10 years ago

People

(Reporter: dbaron, Assigned: rods)

Tracking

({memory-leak})

Trunk
x86
Linux
memory-leak

Firefox Tracking Flags

(Not tracked)

Details

On Linux, viewer is leaking 5 nsBaseWidget every run.  This is a somewhat recent
regression (between 02-21 and 03-18).  The following patch fixes it for me, but
I'm not sure if it's the right thing to do, and I'm not sure if it's OK on all
platforms:

Index: nsBrowserWindow.cpp
===================================================================
RCS file: /cvsroot/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp,v
retrieving revision 3.311
diff -u -r3.311 nsBrowserWindow.cpp
--- nsBrowserWindow.cpp 2000/03/15 01:19:42     3.311
+++ nsBrowserWindow.cpp 2000/03/19 18:19:09
@@ -240,13 +240,13 @@
       }
 
    DestroyWidget(mBack);         
-   mBack = nsnull;
+   NS_IF_RELEASE(mBack);
    DestroyWidget(mForward);      
-   mForward = nsnull;
+   NS_IF_RELEASE(mForward);
    DestroyWidget(mLocation);     
-   mLocation = nsnull;
+   NS_IF_RELEASE(mLocation);
    DestroyWidget(mStatus);       
-   mStatus = nsnull;
+   NS_IF_RELEASE(mStatus);
 
    if(mThrobber)
       {
@@ -256,7 +256,7 @@
       }
 
    DestroyWidget(mWindow);       
-   mWindow = nsnull;
+   NS_IF_RELEASE(mWindow);
 
    return NS_OK;
 }
Keywords: mlk
(Assignee)

Comment 1

19 years ago
I'll take this one
Assignee: rickg → rods
(Assignee)

Comment 2

19 years ago
I am almost wondering if the release shouldn't go into the DestroyWidget method. 
 But we have to look and see why the mWindow isn't being released.
Status: NEW → ASSIGNED
(Assignee)

Comment 3

19 years ago
This fixes it on WinNT and Linux, I have also added asserts to notify us of 
leaks in the future.
Summary: Viewer leaking widgets → [FIX]Viewer leaking widgets
(Assignee)

Comment 4

19 years ago
changing to M15
Target Milestone: --- → M15
(Assignee)

Comment 5

19 years ago
fixed
Status: ASSIGNED → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → FIXED
Reopening.  I don't think NS_ASSERTION evaluates its arguments in an optimized
build.  Therefore this will still leak in optimized builds, but not debug.  (I
really don't see the need for the assertions.  If things leak, they can be
caught by setting XPCOM_MEM_LEAK_LOG.)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 7

19 years ago
Very good catch, I'll check in the fix tmorrow.
Status: REOPENED → ASSIGNED
(Assignee)

Comment 8

19 years ago
fixed again
Status: ASSIGNED → RESOLVED
Last Resolved: 19 years ago19 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.