From f67310964df72996863f772fb1bbf9aeb9ee3744 Mon Sep 17 00:00:00 2001 From: timeless Date: Thu, 3 Dec 2009 01:37:33 -0600 Subject: [PATCH] Bug 530322 - crash [@ nsWindowWatcher::SizeOpenedDocShellItem(nsIDocShellTreeItem*, nsIDOMWindow*, SizeSpec const&)] [r=bzbarsky] --- .../components/windowwatcher/src/nsWindowWatcher.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index cec251016f7..6ea021be037 100644 --- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -1921,7 +1921,14 @@ nsWindowWatcher::SizeOpenedDocShellItem(nsIDocShellTreeItem *aDocShellItem, } if (mainWidget) { nsCOMPtr ctx = mainWidget->GetDeviceContext(); - devPixelsPerCSSPixel = float(ctx->AppUnitsPerCSSPixel()) / ctx->AppUnitsPerDevPixel(); + /* we might be called by an extension after mainWidget::OnDestroy() */ + if (ctx) { + PRInt32 unitsPerDevPixel = ctx->AppUnitsPerDevPixel(); + if (unitsPerDevPixel) { + devPixelsPerCSSPixel = float(ctx->AppUnitsPerCSSPixel()) / + unitsPerDevPixel; + } + } } /* The current position and size will be unchanged if not specified