diff --git a/view/src/nsView.cpp b/view/src/nsView.cpp index b82014d2bab..060691451a9 100644 --- a/view/src/nsView.cpp +++ b/view/src/nsView.cpp @@ -1051,10 +1051,17 @@ nsView::WillPaintWindow(nsIWidget* aWidget, bool aWillSendDidPaint) bool nsView::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion, uint32_t aFlags) { + NS_ASSERTION(this == nsView::GetViewFor(aWidget), "wrong view for widget?"); + mInAlternatePaint = aFlags & PAINT_IS_ALTERNATE; nsCOMPtr vm = mViewManager; bool result = vm->PaintWindow(aWidget, aRegion, aFlags); - mInAlternatePaint = false; + // PaintWindow can destroy this via WillPaintWindow notification, so we have + // to re-get the view from the widget. + nsView* view = nsView::GetViewFor(aWidget); + if (view) { + view->mInAlternatePaint = false; + } return result; }