Closed Bug 59069 Opened 24 years ago Closed 24 years ago

evil nsCOMPtr usage in nsWebShellWindow.cpp

Categories

(SeaMonkey :: UI Design, defect, P3)

x86
Linux
defect

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 59414
mozilla0.9

People

(Reporter: dbaron, Assigned: dbaron)

Details

Using & to dereference an nsCOMPtr for a getter is evil.  (If the nsCOMPtr is
null, which it presumably is here, it won't leak, but it's still evil, since it
confuses nsCOMPtr leak logging.)  This missed being changed when mWindow was
made an nsCOMPtr:

Index: nsWebShellWindow.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp,v
retrieving revision 1.320
diff -u -d -r1.320 nsWebShellWindow.cpp
--- nsWebShellWindow.cpp	2000/11/01 01:20:59	1.320
+++ nsWebShellWindow.cpp	2000/11/04 01:25:16
@@ -257,8 +257,7 @@
   nsRect r(0, 0, aInitialWidth, aInitialHeight);

   // Create top level window
-  rv = nsComponentManager::CreateInstance(kWindowCID, nsnull,
NS_GET_IID(nsIWidget),
-                                    (void**)&mWindow);
+  mWindow = do_CreateInstance(kWindowCID, &rv);
   if (NS_OK != rv) {
     return rv;
   }

For lack of a clear owner of this file:  rpotts, could you review this, since
you wrote this line originally?
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
dup of more general bug

*** This bug has been marked as a duplicate of 59414 ***
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
v
Status: RESOLVED → VERIFIED
Product: Core → Mozilla Application Suite
You need to log in before you can comment on or make changes to this bug.