From 97fa759278ec5ee06c8e3d8b8907d7e2767e2968 Mon Sep 17 00:00:00 2001 From: Rob Arnold Date: Wed, 12 May 2010 14:31:24 -0400 Subject: [PATCH] Bug 562253 - Ensure the proxy window is destroyed before tearing down the taskbar preview r=jimm --- widget/src/windows/TaskbarTabPreview.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/widget/src/windows/TaskbarTabPreview.cpp b/widget/src/windows/TaskbarTabPreview.cpp index 08b3f0b8c90a..f742a002298a 100644 --- a/widget/src/windows/TaskbarTabPreview.cpp +++ b/widget/src/windows/TaskbarTabPreview.cpp @@ -69,6 +69,13 @@ TaskbarTabPreview::~TaskbarTabPreview() { ::DestroyIcon(mIcon); mIcon = NULL; } + + // We need to ensure that proxy window disappears or else Bad Things happen. + if (mProxyWindow) + Disable(); + + NS_ASSERTION(!mProxyWindow, "Taskbar proxy window was not destroyed!"); + if (mWnd) DetachFromNSWindow(); } @@ -271,7 +278,11 @@ TaskbarTabPreview::Enable() { nsresult TaskbarTabPreview::Disable() { - TaskbarPreview::Disable(); + // TaskbarPreview::Disable assumes that mWnd is valid but this method can be + // called when it is null iff the nsWindow has already been destroyed and we + // are still visible for some reason during object destruction. + if (mWnd) + TaskbarPreview::Disable(); if (FAILED(mTaskbar->UnregisterTab(mProxyWindow))) return NS_ERROR_FAILURE;