Bug 590546 - Incubator embedding: [@ ConsoleListener::Observe] crashes on MozView destroy r=mark.finkle
authorTatiana Meshkova <tanya.meshkova@gmail.com>
Wed, 25 Aug 2010 11:46:21 -0700
changeset 129 64e8cf2dd4e9566f0eba048550db463a7032656f
parent 128 fd2905d0088cd27ed8cfd4c33fad8a65a914b6f0
child 130 29ac0fe51754fef58b0ea3c51ce0f02dd815b8bc
push id41
push usertanya.meshkova@gmail.com
push dateWed, 25 Aug 2010 19:13:41 +0000
reviewersmark.finkle
bugs590546
Bug 590546 - Incubator embedding: [@ ConsoleListener::Observe] crashes on MozView destroy r=mark.finkle
common/embed.cpp
--- a/common/embed.cpp
+++ b/common/embed.cpp
@@ -296,16 +296,17 @@ MozView::MozView()
         return;// NS_ERROR_UNEXPECTED;
 
     wwatch->SetWindowCreator(sWindowCreator);
 }
 
 MozView::~MozView()
 {
     delete mPrivate;
+    mPrivate = NULL;
     TermEmbedding();
 }
 
 nsresult MozView::CreateBrowser(void* aParentWindow,
                                 PRInt32 aX, PRInt32 aY,
                                 PRInt32 aWidth, PRInt32 aHeight,
                                 PRUint32 aChromeFlags)
 {
@@ -484,16 +485,19 @@ void MozView::SetListener(MozViewListene
     // XXX shouldn't you tell the old listener it's done?
     mPrivate->mListener = aNewListener;
     if (aNewListener)
         mPrivate->mListener->SetMozView(this);
 }
 
 MozViewListener* MozView::GetListener()
 {
+    if (!mPrivate)
+        return NULL;
+
     return mPrivate->mListener;
 }
 
 void* MozView::GetParentWindow()
 {
     return mPrivate->mParentWindow;
 }