Be more careful when detaching an old window. b=374102 r+sr=roc

This commit is contained in:
mats.palmgren@bredband.net 2007-05-13 17:43:13 -07:00
parent 587e9762aa
commit 8e24a56d18

View File

@ -609,8 +609,13 @@ nsresult nsIView::CreateWidget(const nsIID &aWindowIID,
nsIDeviceContext *dx; nsIDeviceContext *dx;
nsRect trect = mDimBounds; nsRect trect = mDimBounds;
NS_ASSERTION(!mWindow, "We already have a window for this view? BAD"); if (NS_UNLIKELY(mWindow)) {
NS_IF_RELEASE(mWindow); NS_ERROR("We already have a window for this view? BAD");
ViewWrapper* wrapper = GetWrapperFor(mWindow);
NS_IF_RELEASE(wrapper);
mWindow->SetClientData(nsnull);
NS_RELEASE(mWindow);
}
mViewManager->GetDeviceContext(dx); mViewManager->GetDeviceContext(dx);
float scale = 1.0f / dx->AppUnitsPerDevPixel(); float scale = 1.0f / dx->AppUnitsPerDevPixel();