From a8c89110566d491438da52eb40447f1ac16d0119 Mon Sep 17 00:00:00 2001 From: "mats.palmgren@bredband.net" Date: Sun, 29 Apr 2007 17:46:27 -0700 Subject: [PATCH] Lookup the view again since WillPaint() might lead to its destruction. b=378273 r+sr=roc --- view/src/nsViewManager.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index 7abdf0678e3..c1dc34224b8 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -1215,6 +1215,10 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS 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 @@ -1222,8 +1226,11 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS 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