Closed Bug 21970 Opened 25 years ago Closed 25 years ago

[DOGFOOD][CRASH] in nsGlobalWindow.cpp when switching between mail folders

Categories

(MailNews Core :: Backend, defect, P3)

Other
Other
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: sspitzer, Assigned: travis)

Details

(Whiteboard: [PDT-])

Attachments

(1 file)

to reproduce do this:

I have two imap accounts in 5.0, remember password is off for the second.
log on to the first imap server, check the inbox.
switch the second server's inbox, and the password dialog comes up.
click cancel (you'll have to do this twice) click back on the first
server's inbox.  crash.

stack trace coming soon.

the following patch will fix it:
Index: dom/src/base/nsGlobalWindow.cpp
===================================================================
RCS file:
/cvsroot/mozilla/dom/src/base/nsGlobalWindow.cpp,v
retrieving revision 1.193
diff -p -r1.193 nsGlobalWindow.cpp
*** nsGlobalWindow.cpp  1999/12/15 03:59:38
  1.193
--- nsGlobalWindow.cpp  1999/12/16 21:44:05
***************
GlobalWindowImpl::GetPrivateParent(nsPID
*** 3535,3540 ****
--- 3535,3542 ----

         NS_ENSURE_SUCCESS(chromeElement->GetDocument(*getter_AddRefs(doc)),

          NS_ERROR_FAILURE);

+        if (!doc) return NS_ERROR_FAILURE;
+

         nsCOMPtr<nsIScriptGlobalObject> globalObject;

doc->GetScriptGlobalObject(getter_AddRefs(globalObject));

NS_ENSURE_TRUE(globalObject, NS_ERROR_FAILURE);
Summary: [CRASH] in nsGlobalWindow.cpp when switching folders → [DOGFOOD][CRASH] in nsGlobalWindow.cpp when switching between mail folders
travis, this looks like another case of using NS_ENSURE_SUCCESS where rv is
NS_OK, but null is value of what comes back.
Well really a case of checking the return of the function when all I really
cared about was getting a valid pointer back.  Since nsnull is a valid
document.  Is this an M12 holder or can this land when the tree opens?
Status: NEW → ASSIGNED
Actually, this function is broken in a few other ways.  null should be returned
from the function if there isn't a parent....  If the doc fails, then this
should not return failure but a null parent.
I'll leave it to travis to fix the function.
it sounds like there is more problems.

but since there is a crasher here, any objections to checking in the crasher fix
now?
The new function looks a little something like this....

NS_IMETHODIMP
GlobalWindowImpl::GetPrivateParent(nsPIDOMWindow** aParent)
{
   nsCOMPtr<nsIDOMWindow> parent;
   *aParent = nsnull; // Set to null so we can bail out later

   GetParent(getter_AddRefs(parent));

   if(NS_STATIC_CAST(nsIDOMWindow*, this) == parent.get())
      {
      nsCOMPtr<nsIContent> chromeElement(do_QueryInterface
(mChromeEventHandler));
      if(!chromeElement)
         return NS_OK; // This is ok, just means a null parent.

      nsCOMPtr<nsIDocument> doc;
      chromeElement->GetDocument(*getter_AddRefs(doc));
      if(!doc)
         return NS_OK; // This is ok, just means a null parent.

      nsCOMPtr<nsIScriptGlobalObject> globalObject;
      doc->GetScriptGlobalObject(getter_AddRefs(globalObject));
      if(!globalObject)
         return NS_OK; // This is ok, just means a null parent.

      parent = do_QueryInterface(globalObject);
      }

   if(parent)
      CallQueryInterface(parent.get(), aParent;

   return NS_OK;
}
Whiteboard: [PDT-]
Putting on the PDT- radar.  Spoke with spitzer.  Cool with pdt-....also, he'd
like to see this on the trunk...not the M12 branch...can this be marked M13?
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Fixed
QA Contact: lchiang → laurel
OK using:
 2000-02-09-08m14 commercial build on linux rh6.0
 2000-02-09-08m14 commercial build on NT 4.0
Whiteboard: [PDT-] → [PDT-] feb09: verified win32 and linux. Mac pending.
Can't verify on mac because remember password is broken.  See bug #27160.
Whiteboard: [PDT-] feb09: verified win32 and linux. Mac pending. → [PDT-] feb15: Mac waiting for 27160 fix.
I verified this for mac using the master password scheme.
One IMAP server remembered/listed in password manager.
One IMAP server not  remembered/listed in password manager.

OK using 2000-03-07-09m15 commercial build on mac OS 9.0
Status: RESOLVED → VERIFIED
Whiteboard: [PDT-] feb15: Mac waiting for 27160 fix. → [PDT-]
Product: MailNews → Core
Depends on: 427729
No longer depends on: 427729
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: