b=797568 call Finish() on old surfaces before passing them back to child r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 31 Oct 2012 15:54:42 +1300
changeset 111998 1ba88bd2f4407ccb49f73efce360714b5e36ff64
parent 111997 541b971b847b323dfdd8b3995c5945dd296d68be
child 111999 f6ced9fd4fc54fe680e3eeb37fb796bc160edb21
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersroc
bugs797568
milestone19.0a1
b=797568 call Finish() on old surfaces before passing them back to child r=roc
dom/plugins/ipc/PluginInstanceParent.cpp
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -594,26 +594,31 @@ PluginInstanceParent::RecvShow(const NPR
 #ifdef XP_WIN
     else if (newSurface.type() == SurfaceDescriptor::TPPluginSurfaceParent) {
         PluginSurfaceParent* s =
             static_cast<PluginSurfaceParent*>(newSurface.get_PPluginSurfaceParent());
         surface = s->Surface();
     }
 #endif
 
-#ifdef MOZ_X11
-    if (mFrontSurface &&
-        mFrontSurface->GetType() == gfxASurface::SurfaceTypeXlib)
+    if (mFrontSurface) {
         // This is the "old front buffer" we're about to hand back to
         // the plugin.  We might still have drawing operations
-        // referencing it, so we XSync here to let them finish before
-        // the plugin starts scribbling on it again, or worse,
-        // destroys it.
-        FinishX(DefaultXDisplay());
+        // referencing it.
+        mFrontSurface->Finish();
+
+#ifdef MOZ_X11
+        if (mFrontSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
+            // XSync here to ensure the server has finished operations on the
+            // surface before the plugin starts scribbling on it again, or
+            // worse, destroys it.
+            FinishX(DefaultXDisplay());
+        }
 #endif
+    }
 
     if (mFrontSurface && gfxSharedImageSurface::IsSharedImage(mFrontSurface))
         *prevSurface = static_cast<gfxSharedImageSurface*>(mFrontSurface.get())->GetShmem();
     else
         *prevSurface = null_t();
 
     if (surface) {
         // Notify the cairo backend that this surface has changed behind