Hello list,

the attached patch fixes the segmentation fault of the originalwindow
occuring under recent versions of libwebkit when a link is requested
to be opened in a new window using the mouse. Testing appreciated!

Hannes
diff --git a/main.c b/main.c
index e13bae5..d90c4c2 100644
--- a/main.c
+++ b/main.c
@@ -53,7 +53,9 @@ static void webview_load_committed_cb(WebKitWebView *webview, WebKitWebFrame *fr
 static void webview_load_finished_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpointer user_data);
 static gboolean webview_mimetype_cb(WebKitWebView *webview, WebKitWebFrame *frame, WebKitNetworkRequest *request,
                         char *mime_type, WebKitWebPolicyDecision *decision, gpointer user_data);
-static void webview_open_js_window_cb(WebKitWebView* temp_view, GParamSpec param_spec);
+static void webview_open_js_window_cb(WebKitWebView *temp_view, WebKitWebFrame *frame, 
+        WebKitNetworkRequest *request, WebKitWebNavigationAction *action, 
+        WebKitWebPolicyDecision *policy, gpointer data);
 static gboolean webview_new_window_cb(WebKitWebView *webview, WebKitWebFrame *frame, WebKitNetworkRequest *request,
                         WebKitWebNavigationAction *action, WebKitWebPolicyDecision *decision, gpointer user_data);
 static WebKitWebView* webview_open_in_new_window_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpointer user_data);
@@ -208,14 +210,14 @@ webview_load_finished_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpointer
 }
 
 void
-webview_open_js_window_cb(WebKitWebView* temp_view, GParamSpec param_spec) {
-    /* retrieve the URI of the temporary webview */
-    Arg a = { .i = TargetNew, .s = (char*)webkit_web_view_get_uri(temp_view) };
-    /* clean up */
-    webkit_web_view_stop_loading(temp_view);
-    gtk_widget_destroy(GTK_WIDGET(temp_view));
+webview_open_js_window_cb(WebKitWebView *temp_view, WebKitWebFrame *frame, 
+        WebKitNetworkRequest *request, WebKitWebNavigationAction *action, 
+        WebKitWebPolicyDecision *policy, gpointer data) {
+    Arg a = { .i = TargetNew, .s = (char*)webkit_network_request_get_uri(request)};
     /* open the requested window */
     open_arg(&a);
+    /* clean up */
+    gtk_widget_destroy(GTK_WIDGET(temp_view));
 }
 
 static WebKitWebView *
@@ -223,7 +225,7 @@ webview_open_in_new_window_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpo
     /* create a temporary webview to execute the script in */
     WebKitWebView *temp_view = WEBKIT_WEB_VIEW(webkit_web_view_new());
     /* wait until the new webview receives its new URI */
-    g_object_connect(temp_view, "signal::notify::uri", G_CALLBACK(webview_open_js_window_cb), NULL, NULL);
+    g_signal_connect(temp_view, "navigation-policy-decision-requested", G_CALLBACK(webview_open_js_window_cb), NULL);
     return temp_view;
 }
 
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Vimprobable-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vimprobable-users

Reply via email to