mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 820814. Call nsIWidget::Destroy from a runnable when destroying the widget for a view. r=mats
nsIWidget::Destroy can re-enter so do it when it is safe.
This commit is contained in:
parent
052dbe5e55
commit
a705d0c6c5
@ -94,6 +94,24 @@ nsView::~nsView()
|
||||
delete mDirtyRegion;
|
||||
}
|
||||
|
||||
class DestroyWidgetRunnable : public nsRunnable {
|
||||
public:
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
explicit DestroyWidgetRunnable(nsIWidget* aWidget) : mWidget(aWidget) {}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIWidget> mWidget;
|
||||
};
|
||||
|
||||
NS_IMETHODIMP DestroyWidgetRunnable::Run()
|
||||
{
|
||||
mWidget->Destroy();
|
||||
mWidget = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
void nsView::DestroyWidget()
|
||||
{
|
||||
if (mWindow)
|
||||
@ -107,7 +125,11 @@ void nsView::DestroyWidget()
|
||||
}
|
||||
else {
|
||||
mWindow->SetWidgetListener(nullptr);
|
||||
mWindow->Destroy();
|
||||
|
||||
nsCOMPtr<nsIRunnable> widgetDestroyer =
|
||||
new DestroyWidgetRunnable(mWindow);
|
||||
|
||||
NS_DispatchToMainThread(widgetDestroyer);
|
||||
}
|
||||
|
||||
NS_RELEASE(mWindow);
|
||||
|
Loading…
Reference in New Issue
Block a user