evil nsCOMPtr usage in nsWebShellWindow.cpp

VERIFIED DUPLICATE of bug 59414

Status

SeaMonkey
UI Design
P3
normal
VERIFIED DUPLICATE of bug 59414
18 years ago
13 years ago

People

(Reporter: dbaron, Assigned: dbaron)

Tracking

Trunk
mozilla0.9
x86
Linux

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

18 years ago
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?
(Assignee)

Updated

18 years ago
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
(Assignee)

Comment 1

18 years ago
dup of more general bug

*** This bug has been marked as a duplicate of 59414 ***
Status: ASSIGNED → RESOLVED
Last Resolved: 18 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.