Bug 1167069 - Watch out for deletion of current frame. r=jmathies

This commit is contained in:
Steven Michaud 2015-06-17 12:59:34 -05:00
Родитель daeca80401
Коммит d584ce81c9
1 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -607,9 +607,19 @@ nsPluginFrame::CallSetWindow(bool aCheckIsHidden)
if (aCheckIsHidden && IsHidden())
return NS_ERROR_FAILURE;
// Calling either nsPluginInstanceOwner::FixUpPluginWindow() (here,
// on OS X) or SetWindow() (below, on all platforms) can destroy this
// frame. (FixUpPluginWindow() calls SetWindow()). So grab a safe
// reference to mInstanceOwner which we can use below, if needed.
nsRefPtr<nsPluginInstanceOwner> instanceOwnerRef(mInstanceOwner);
// refresh the plugin port as well
#ifdef XP_MACOSX
mInstanceOwner->FixUpPluginWindow(nsPluginInstanceOwner::ePluginPaintEnable);
// Bail now if our frame has been destroyed.
if (!instanceOwnerRef->GetFrame()) {
return NS_ERROR_FAILURE;
}
#endif
window->window = mInstanceOwner->GetPluginPort();
@ -641,10 +651,6 @@ nsPluginFrame::CallSetWindow(bool aCheckIsHidden)
window->width = intBounds.width / intScaleFactor;
window->height = intBounds.height / intScaleFactor;
// Calling SetWindow might destroy this frame. We need to use the instance
// owner to clean up so hold a ref.
nsRefPtr<nsPluginInstanceOwner> instanceOwnerRef(mInstanceOwner);
// This will call pi->SetWindow and take care of window subclassing
// if needed, see bug 132759. Calling SetWindow can destroy this frame
// so check for that before doing anything else with this frame's memory.