Bug 31271 - [Gtk] crashed when destroying
Summary: [Gtk] crashed when destroying
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-09 13:04 PST by Jonh Wendell
Modified: 2010-02-26 09:05 PST (History)
2 users (show)

See Also:


Attachments
small test case (549 bytes, text/plain)
2009-11-09 13:15 PST, Gustavo Noronha (kov)
no flags Details
Fix this crash, by only relaying focus out when the page exists (4.22 KB, patch)
2010-02-25 09:35 PST, Gustavo Noronha (kov)
gns: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.