From 4507d847d52613e487cfd0dc360fc900c9a9adbd Mon Sep 17 00:00:00 2001 From: "kov@webkit.org" Date: Mon, 26 Sep 2011 12:06:02 +0000 Subject: [PATCH] REGRESSION: Empathy crashes when switching theme https://bugs.webkit.org/show_bug.cgi?id=68600 Patch by Gustavo Noronha Silva 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 | 15 +++++++++++++++ Source/WebKit/gtk/webkit/webkitwebview.cpp | 17 ++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 2bbe3b9..f5e4523 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,18 @@ +2011-09-26 Gustavo Noronha Silva + + 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 Always enable ENABLE(OFFLINE_WEB_APPLICATIONS) diff --git a/Source/WebKit/gtk/webkit/webkitwebview.cpp b/Source/WebKit/gtk/webkit/webkitwebview.cpp index 742c421..c169e69 100644 --- a/Source/WebKit/gtk/webkit/webkitwebview.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebview.cpp @@ -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(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(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(); -- 2.7.4