REGRESSION: Empathy crashes when switching theme
authorkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2011 12:06:02 +0000 (12:06 +0000)
committerkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2011 12:06:02 +0000 (12:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68600

Patch by Gustavo Noronha Silva <gustavo.noronha@collabora.com> on 2011-09-26
Reviewed by Martin Robinson.

* webkit/webkitwebview.cpp:
(webkit_web_view_set_scroll_adjustments): use the existing
set{Horizontal,Vertical}Adjustment functions, so the code is not
duplicated
(webkit_web_view_dispose): unset the adjustments during dispose,
to avoid late adjustment change notifications hitting the
adjustment watcher

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95940 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/webkit/webkitwebview.cpp

index 2bbe3b9..f5e4523 100644 (file)
@@ -1,3 +1,18 @@
+2011-09-26  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
+
+        REGRESSION: Empathy crashes when switching theme
+        https://bugs.webkit.org/show_bug.cgi?id=68600
+
+        Reviewed by Martin Robinson.
+
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_set_scroll_adjustments): use the existing
+        set{Horizontal,Vertical}Adjustment functions, so the code is not
+        duplicated
+        (webkit_web_view_dispose): unset the adjustments during dispose,
+        to avoid late adjustment change notifications hitting the
+        adjustment watcher
+
 2011-09-24  Adam Barth  <abarth@webkit.org>
 
         Always enable ENABLE(OFFLINE_WEB_APPLICATIONS)
index 742c421..c169e69 100644 (file)
@@ -427,7 +427,6 @@ static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget)
     return webkit_web_view_forward_context_menu_event(WEBKIT_WEB_VIEW(widget), event);
 }
 
-#ifndef GTK_API_VERSION_2
 static void setHorizontalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment)
 {
     // This may be called after the page has been destroyed, in which case we do nothing.
@@ -444,6 +443,7 @@ static void setVerticalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustm
         static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->setVerticalAdjustment(adjustment);
 }
 
+#ifndef GTK_API_VERSION_2
 static GtkAdjustment* getHorizontalAdjustment(WebKitWebView* webView)
 {
     Page* page = core(webView);
@@ -1039,14 +1039,8 @@ static void webkit_web_view_realize(GtkWidget* widget)
 #ifdef GTK_API_VERSION_2
 static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* horizontalAdjustment, GtkAdjustment* verticalAdjustment)
 {
-    // This may be called after the page has been destroyed, in which case we do nothing.
-    Page* page = core(webView);
-    if (!page)
-        return;
-
-    WebKit::ChromeClient* client = static_cast<WebKit::ChromeClient*>(page->chrome()->client());
-    client->adjustmentWatcher()->setHorizontalAdjustment(horizontalAdjustment);
-    client->adjustmentWatcher()->setVerticalAdjustment(verticalAdjustment);
+    setHorizontalAdjustment(webView, horizontalAdjustment);
+    setVerticalAdjustment(webView, verticalAdjustment);
 }
 #endif
 
@@ -1307,6 +1301,11 @@ static void webkit_web_view_dispose(GObject* object)
 
     priv->disposing = TRUE;
 
+    // Make sure GtkAdjustmentWatcher won't be reacting to adjustment changes after the
+    // WebView is destroyed.
+    setHorizontalAdjustment(webView, 0);
+    setVerticalAdjustment(webView, 0);
+
     // These smart pointers are cleared manually, because some cleanup operations are
     // very sensitive to their value. We may crash if these are done in the wrong order.
     priv->backForwardList.clear();