Bug 614979 - Flash plugin crashes because we don't destroy the plugin window right after NPP_Destroy, which means that messages are being delivered and causing async messages to be queued after NPP_Destroy. Destroy the window earlier, r=jimm a=blocker
authorBenjamin Smedberg <benjamin@smedbergs.us>
Thu, 09 Dec 2010 09:54:26 -0500
changeset 58972 22bb9d6626c55a06df98fc12e5617fb9f04b2d43
parent 58971 36d993e971587bba6fae79ce14e985c98d549afd
child 58973 37c63f75ff2f13195896caa8efd9315071761a28
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersjimm, blocker
bugs614979
milestone2.0b8pre
Bug 614979 - Flash plugin crashes because we don't destroy the plugin window right after NPP_Destroy, which means that messages are being delivered and causing async messages to be queued after NPP_Destroy. Destroy the window earlier, r=jimm a=blocker
dom/plugins/PluginInstanceChild.cpp
--- a/dom/plugins/PluginInstanceChild.cpp
+++ b/dom/plugins/PluginInstanceChild.cpp
@@ -173,17 +173,17 @@ PluginInstanceChild::PluginInstanceChild
         }
     }
 #endif
 }
 
 PluginInstanceChild::~PluginInstanceChild()
 {
 #if defined(OS_WIN)
-  DestroyPluginWindow();
+    NS_ASSERTION(!mPluginWindowHWND, "Destroying PluginInstanceChild without NPP_Destroy?");
 #endif
 #if defined(OS_MACOSX)
     if (mShColorSpace) {
         ::CGColorSpaceRelease(mShColorSpace);
     }
     if (mShContext) {
         ::CGContextRelease(mShContext);
     }
@@ -2995,16 +2995,17 @@ PluginInstanceChild::AnswerNPP_Destroy(N
     // PluginInstanceDestroyed call above.
     mCachedWindowActor = nsnull;
     mCachedElementActor = nsnull;
 
 #if defined(OS_WIN)
     SharedSurfaceRelease();
     DestroyWinlessPopupSurrogate();
     UnhookWinlessFlashThrottle();
+    DestroyPluginWindow();
 #endif
 
     // Pending async calls are discarded, not delivered. This matches the
     // in-process behavior.
     for (PRUint32 i = 0; i < mPendingAsyncCalls.Length(); ++i)
         mPendingAsyncCalls[i]->Cancel();
 
     mPendingAsyncCalls.Clear();