@@ -326,18 +326,17 @@ void nsViewManager::Refresh(nsView* aView,
326326 NS_ASSERTION (GetDisplayRootFor(aView) == aView,
327327 "Widgets that we paint must all be display roots");
328328
329- if (mPresShell ) {
329+ if (RefPtr<PresShell> presShell = mPresShell ) {
330330#ifdef MOZ_DUMP_PAINTING
331331 if (nsLayoutUtils::InvalidationDebuggingIsEnabled ()) {
332- printf_stderr (" --COMPOSITE-- %p\n " , mPresShell );
332+ printf_stderr (" --COMPOSITE-- %p\n " , presShell. get () );
333333 }
334334#endif
335- PaintFlags paintFlags = PaintFlags::PaintComposite;
336335 LayerManager* manager = widget->GetLayerManager ();
337336 if (!manager->NeedsWidgetInvalidation ()) {
338337 manager->FlushRendering ();
339338 } else {
340- mPresShell ->Paint (aView, damageRegion, paintFlags );
339+ presShell ->Paint (aView, damageRegion, PaintFlags::PaintComposite );
341340 }
342341#ifdef MOZ_DUMP_PAINTING
343342 if (nsLayoutUtils::InvalidationDebuggingIsEnabled ()) {
@@ -394,7 +393,8 @@ void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
394393 nsIWidget* widget = widgets[i];
395394 nsView* view = nsView::GetViewFor (widget);
396395 if (view) {
397- view->GetViewManager ()->ProcessPendingUpdatesPaint (widget);
396+ RefPtr<nsViewManager> viewManager = view->GetViewManager ();
397+ viewManager->ProcessPendingUpdatesPaint (MOZ_KnownLive (widget));
398398 }
399399 }
400400 SetPainting (false );
@@ -450,16 +450,16 @@ void nsViewManager::ProcessPendingUpdatesPaint(nsIWidget* aWidget) {
450450 return ;
451451 }
452452
453- if (mPresShell ) {
453+ if (RefPtr<PresShell> presShell = mPresShell ) {
454454#ifdef MOZ_DUMP_PAINTING
455455 if (nsLayoutUtils::InvalidationDebuggingIsEnabled ()) {
456456 printf_stderr (
457457 " ---- PAINT START ----PresShell(%p), nsView(%p), nsIWidget(%p)\n " ,
458- mPresShell , view, aWidget);
458+ presShell. get () , view, aWidget);
459459 }
460460#endif
461461
462- mPresShell ->Paint (view, nsRegion (), PaintFlags::PaintLayers);
462+ presShell ->Paint (view, nsRegion (), PaintFlags::PaintLayers);
463463 view->SetForcedRepaint (false );
464464
465465#ifdef MOZ_DUMP_PAINTING
@@ -1006,7 +1006,8 @@ void nsViewManager::IsPainting(bool& aIsPainting) {
10061006
10071007void nsViewManager::ProcessPendingUpdates () {
10081008 if (!IsRootVM ()) {
1009- RootViewManager ()->ProcessPendingUpdates ();
1009+ RefPtr<nsViewManager> rootViewManager = RootViewManager ();
1010+ rootViewManager->ProcessPendingUpdates ();
10101011 return ;
10111012 }
10121013
@@ -1023,13 +1024,13 @@ void nsViewManager::ProcessPendingUpdates() {
10231024
10241025void nsViewManager::UpdateWidgetGeometry () {
10251026 if (!IsRootVM ()) {
1026- RootViewManager ()->UpdateWidgetGeometry ();
1027+ RefPtr<nsViewManager> rootViewManager = RootViewManager ();
1028+ rootViewManager->UpdateWidgetGeometry ();
10271029 return ;
10281030 }
10291031
10301032 if (mHasPendingWidgetGeometryChanges ) {
10311033 mHasPendingWidgetGeometryChanges = false ;
1032- RefPtr<nsViewManager> strongThis (this );
10331034 ProcessPendingUpdatesForView (mRootView , false );
10341035 }
10351036}
0 commit comments