Lookup the view again since WillPaint() might lead to its destruction.
b=378273 r+sr=roc
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -1210,25 +1210,32 @@ NS_IMETHODIMP nsViewManager::DispatchEve
// observer may try to reenter this code from inside
// WillPaint() by trying to do a synchronous paint, but since
// refresh will be disabled it won't be able to do the paint.
// We should really sort out the rules on our synch painting
// api....
BeginUpdateViewBatch();
observer->WillPaint();
EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
+
+ // Get the view pointer again since the code above might have
+ // destroyed it (bug 378273).
+ view = nsView::GetViewFor(aEvent->widget);
}
}
// Make sure to sync up any widget geometry changes we
// have pending before we paint.
if (rootVM->mHasPendingUpdates) {
rootVM->ProcessPendingUpdates(mRootView, PR_FALSE);
}
- Refresh(view, event->renderingContext, region,
- NS_VMREFRESH_DOUBLE_BUFFER);
+
+ if (view) {
+ Refresh(view, event->renderingContext, region,
+ NS_VMREFRESH_DOUBLE_BUFFER);
+ }
}
} else {
// since we got an NS_PAINT event, we need to
// draw something so we don't get blank areas.
nsRect damRect;
region->GetBoundingBox(&damRect.x, &damRect.y, &damRect.width, &damRect.height);
PRInt32 p2a = mContext->AppUnitsPerDevPixel();
damRect.ScaleRoundOut(float(p2a));