Bug 530322 - crash [@ nsWindowWatcher::SizeOpenedDocShellItem(nsIDocShellTreeItem*, nsIDOMWindow*, SizeSpec const&)] [r=bzbarsky]

This commit is contained in:
timeless 2009-12-03 01:37:33 -06:00
parent 83956299ff
commit f67310964d

View File

@ -1921,7 +1921,14 @@ nsWindowWatcher::SizeOpenedDocShellItem(nsIDocShellTreeItem *aDocShellItem,
}
if (mainWidget) {
nsCOMPtr<nsIDeviceContext> 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