Bug 31271

Summary: [Gtk] crashed when destroying
Product: WebKit Reporter: Jonh Wendell <wendell>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Major CC: gns, jmalonzo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
small test case
none
Fix this crash, by only relaying focus out when the page exists gns: commit-queue-

Description Jonh Wendell 2009-11-09 13:04:04 PST
I'm getting a segfault when destroying the WebView widget in a idle callback. Piece of code:

...
  g_signal_connect (self,
		    "navigation-policy-decision-requested",
		    G_CALLBACK (link_cb),
		    NULL);
...

static gboolean
link_cb (WebKitWebView             *web_view,
	 WebKitWebFrame            *frame,
	 WebKitNetworkRequest      *request,
	 WebKitWebNavigationAction *navigation_action,
	 WebKitWebPolicyDecision   *policy_decision,
	 gpointer                   user_data)
{
  const gchar *uri;

  uri = webkit_network_request_get_uri (request);
  if (strncmp (uri, "ascli://remove", 14) == 0)
    {
      webkit_web_policy_decision_ignore (policy_decision);
      g_idle_add ((GSourceFunc) delayed_destroy, web_view);
      return TRUE;
    }

  return FALSE;
}

...

static gboolean
delayed_destroy (GtkWidget *w)
{
  gtk_widget_destroy (w);  <<<<----------- CRASH
  return FALSE;
}

......

I'm putting the WebView inside a GtkVBox
Comment 1 Gustavo Noronha (kov) 2009-11-09 13:15:00 PST
Created attachment 42792 [details]
small test case

I wrote this small test case to demonstrate the crash. Replacing WebView with GtkTextView there makes the crash go away, which implies this is a bug in our stuff.
Comment 2 Gustavo Noronha (kov) 2010-02-25 09:35:36 PST
Created attachment 49497 [details]
Fix this crash, by only relaying focus out when the page exists
Comment 3 Gustavo Noronha (kov) 2010-02-25 10:18:49 PST
Comment on attachment 49497 [details]
Fix this crash, by only relaying focus out when the page exists

Landed as r55245 with minor changes to not require the 200ms timeout on the test. Reviewed by Xan over XMPP.