Bug 1207161 - fix run-by-dir leak in test_bug846906.xul; r=mccr8

This commit is contained in:
Nathan Froyd 2015-10-12 21:41:35 -04:00
parent 04f5074ec1
commit 4e7e5703c8
2 changed files with 6 additions and 2 deletions

View File

@ -80,7 +80,6 @@ skip-if = os == 'linux' || os == 'mac' # Bug 1026815
[test_bug690056.xul]
[test_bug789773.xul]
[test_bug846906.xul]
skip-if = (os == 'linux' && asan) || debug # Bug 1207161
[test_bug89419.xul]
[test_bug909218.html]
[test_bug92598.xul]

View File

@ -136,7 +136,12 @@ void nsView::DestroyWidget()
nsCOMPtr<nsIRunnable> widgetDestroyer =
new DestroyWidgetRunnable(mWindow);
NS_DispatchToMainThread(widgetDestroyer);
// Don't leak if we happen to arrive here after the main thread
// has disappeared.
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
if (mainThread) {
mainThread->Dispatch(widgetDestroyer.forget(), NS_DISPATCH_NORMAL);
}
}
mWindow = nullptr;