Bug 805745. WillPaint notification can flush, so re-get the listener after it on GTK2 widget backend. r=karlt
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 12 Dec 2012 15:57:08 -0600
changeset 115849 9aae7b226f3dc07aaa25bd84ddef1941f30aa848
parent 115848 789e54325d765bb01d6d2c3b1a2b530cb1b93999
child 115850 65d0aedb6ac48909cd1fd09c91ab086db7d86c71
push id24028
push useremorley@mozilla.com
push dateThu, 13 Dec 2012 15:56:02 +0000
treeherderautoland@9db79b97abbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs805745
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 805745. WillPaint notification can flush, so re-get the listener after it on GTK2 widget backend. r=karlt
widget/gtk2/nsWindow.cpp
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -2029,16 +2029,23 @@ nsWindow::OnExposeEvent(cairo_t *cr)
     // before we paint
     {
         listener->WillPaintWindow(this, true);
 
         // If the window has been destroyed during the will paint notification,
         // there is nothing left to do.
         if (!mGdkWindow)
             return TRUE;
+
+        // Re-get the listener since the will paint notification might have
+        // killed it.
+        listener =
+            mAttachedWidgetListener ? mAttachedWidgetListener : mWidgetListener;
+        if (!listener)
+            return FALSE;
     }
 
 #if defined(MOZ_WIDGET_GTK2)
     GdkRectangle *rects;
     gint nrects;
     gdk_region_get_rectangles(aEvent->region, &rects, &nrects);
     if (MOZ_UNLIKELY(!rects)) // OOM
         return FALSE;