Bug 611033 - Don't retain the plugin surface beyond the lifetime of the PluginInstanceParent: we only guarantee that the plugin X socket will kept alive until PluginModuleParent::ActorDestroy, r=karlt

This commit is contained in:
Benjamin Smedberg 2010-11-11 08:43:54 -05:00
parent 542fdd7b82
commit 0aa2cd1075
2 changed files with 16 additions and 1 deletions

View File

@ -172,6 +172,19 @@ PluginInstanceParent::ActorDestroy(ActorDestroyReason why)
UnsubclassPluginWindow();
}
#endif
// After this method, the data backing the remote surface may no
// longer be calid. The X surface may be destroyed, or the shared
// memory backing this surface may no longer be valid. The right
// way to inform the nsObjectFrame that the surface is no longer
// valid is with an invalidate call.
if (mFrontSurface) {
mFrontSurface = NULL;
const NPRect rect = {0, 0, 0, 0};
RecvNPN_InvalidateRect(rect);
#ifdef MOZ_X11
XSync(DefaultXDisplay(), False);
#endif
}
}
NPError

View File

@ -1711,8 +1711,10 @@ PRBool
nsPluginInstanceOwner::SetCurrentImage(ImageContainer* aContainer)
{
mInstance->GetSurface(getter_AddRefs(mLayerSurface));
if (!mLayerSurface)
if (!mLayerSurface) {
aContainer->SetCurrentImage(nsnull);
return PR_FALSE;
}
Image::Format format = Image::CAIRO_SURFACE;
nsRefPtr<Image> image;