[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.21-1-592-g6d53b0e

Gustavo Noronha Silva kov at debian.org
Fri Feb 26 22:50:19 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 6d53b0e389ef593628caabfb4b43da2bc68dd3e0
Author: kov at webkit.org <kov at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Feb 25 18:18:02 2010 +0000

    2010-02-25  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
    
            Reviewed by Xan Lopez.
    
            [Gtk] crashed when destroying
            https://bugs.webkit.org/show_bug.cgi?id=31271
    
            NULL-check the page before relaying the focus out event, since
            this might happen when destroying the widget without destroying
            its parent, and we currently crash.
    
            * tests/testwebview.c:
            (delayed_destroy):
            (test_webkit_web_view_destroy):
            (main):
            * webkit/webkitwebview.cpp:
            (webkit_web_view_focus_in_event):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55245 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/gtk/tests/testwebview.c b/WebKit/gtk/tests/testwebview.c
index 34b6867..3709029 100644
--- a/WebKit/gtk/tests/testwebview.c
+++ b/WebKit/gtk/tests/testwebview.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2008 Holger Hans Peter Freyther
- * Copyright (C) 2009 Collabora Ltd.
+ * Copyright (C) 2009, 2010 Collabora Ltd.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -224,6 +224,37 @@ static void test_webkit_web_view_adjustments()
     do_test_webkit_web_view_adjustments(TRUE);
 }
 
+gboolean delayed_destroy(gpointer data)
+{
+    gtk_widget_destroy(GTK_WIDGET(data));
+    g_main_loop_quit(loop);
+    return FALSE;
+}
+
+static void test_webkit_web_view_destroy()
+{
+    GtkWidget* window;
+    GtkWidget* web_view;
+
+    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    web_view = webkit_web_view_new();
+
+    gtk_container_add(GTK_CONTAINER(window), web_view);
+
+    gtk_widget_show_all(window);
+
+    loop = g_main_loop_new(NULL, TRUE);
+
+    g_signal_connect(window, "map-event",
+                     G_CALLBACK(map_event_cb), loop);
+    g_main_loop_run(loop);
+
+    g_idle_add(delayed_destroy, web_view);
+    g_main_loop_run(loop);
+
+    gtk_widget_destroy(window);
+}
+
 int main(int argc, char** argv)
 {
     SoupServer* server;
@@ -258,6 +289,7 @@ int main(int argc, char** argv)
     g_test_bug_base("https://bugs.webkit.org/");
     g_test_add_func("/webkit/webview/icon-uri", test_webkit_web_view_icon_uri);
     g_test_add_func("/webkit/webview/adjustments", test_webkit_web_view_adjustments);
+    g_test_add_func("/webkit/webview/destroy", test_webkit_web_view_destroy);
 
     return g_test_run ();
 }
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index d6a8b83..866833e 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -6,7 +6,7 @@
  *  Copyright (C) 2008 Jan Alonzo <jmalonzo at unpluggable.com>
  *  Copyright (C) 2008 Gustavo Noronha Silva <gns at gnome.org>
  *  Copyright (C) 2008 Nuanti Ltd.
- *  Copyright (C) 2008, 2009 Collabora Ltd.
+ *  Copyright (C) 2008, 2009, 2010 Collabora Ltd.
  *  Copyright (C) 2009 Igalia S.L.
  *  Copyright (C) 2009 Movial Creative Technologies Inc.
  *  Copyright (C) 2009 Bobby Powers
@@ -678,8 +678,13 @@ static gboolean webkit_web_view_focus_out_event(GtkWidget* widget, GdkEventFocus
 {
     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
 
-    core(webView)->focusController()->setActive(false);
-    core(webView)->focusController()->setFocused(false);
+    // We may hit this code while destroying the widget, and we might
+    // no longer have a page, then.
+    Page* page = core(webView);
+    if (page) {
+        page->focusController()->setActive(false);
+        page->focusController()->setFocused(false);
+    }
 
     return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_out_event(widget, event);
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list