From 672c06e08eccc5cfc7d72ef1f313e44b8ae3172a Mon Sep 17 00:00:00 2001 From: Felipe Gomes Date: Thu, 3 Feb 2011 16:47:23 -0800 Subject: [PATCH] Bug 556524. Check for nsWindow existence before creating taskbar preview. r=roc a=blocker --- browser/components/wintaskbar/WindowsPreviewPerTab.jsm | 8 +++++++- widget/src/windows/WinTaskbar.cpp | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/browser/components/wintaskbar/WindowsPreviewPerTab.jsm b/browser/components/wintaskbar/WindowsPreviewPerTab.jsm index 1f264c1ce9a..0ada545181a 100644 --- a/browser/components/wintaskbar/WindowsPreviewPerTab.jsm +++ b/browser/components/wintaskbar/WindowsPreviewPerTab.jsm @@ -459,7 +459,13 @@ TabWindow.prototype = { .QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShell); - let preview = AeroPeek.taskbar.createTaskbarTabPreview(docShell, controller); + let preview; + try { + preview = AeroPeek.taskbar.createTaskbarTabPreview(docShell, controller); + } catch (e) { + controller.destroy(); + return; + } preview.visible = AeroPeek.enabled; preview.active = this.tabbrowser.selectedTab == tab; // Grab the default favicon diff --git a/widget/src/windows/WinTaskbar.cpp b/widget/src/windows/WinTaskbar.cpp index 2acac7dab51..5a02581c6cf 100644 --- a/widget/src/windows/WinTaskbar.cpp +++ b/widget/src/windows/WinTaskbar.cpp @@ -359,6 +359,11 @@ WinTaskbar::CreateTaskbarTabPreview(nsIDocShell *shell, nsITaskbarPreviewControl if (!toplevelHWND) return NS_ERROR_INVALID_ARG; + nsWindow *window = nsWindow::GetNSWindowPtr(toplevelHWND); + + if (!window) + return NS_ERROR_INVALID_ARG; + nsRefPtr preview(new TaskbarTabPreview(mTaskbar, controller, toplevelHWND, shell)); if (!preview) return NS_ERROR_OUT_OF_MEMORY;