r18408 - gnucash/trunk/src/html - Bug 600947 - Gnucash-2.3.7 crashes when doing reports with webkit-1.1.15

Phil Longstaff plongstaff at code.gnucash.org
Mon Nov 9 18:35:26 EST 2009


Author: plongstaff
Date: 2009-11-09 18:35:25 -0500 (Mon, 09 Nov 2009)
New Revision: 18408
Trac: http://svn.gnucash.org/trac/changeset/18408

Modified:
   gnucash/trunk/src/html/gnc-html-webkit.c
Log:
Bug 600947 -  Gnucash-2.3.7 crashes when doing reports with webkit-1.1.15

Handle the "navigation requested" callback correctly.  It was being called with
the uri "base-uri" when a page was being loaded.  This needed to be accepted.
Then, when clicking on an account name, the correct register needs to be
opened and the navigation status needs to be IGNORE.


Modified: gnucash/trunk/src/html/gnc-html-webkit.c
===================================================================
--- gnucash/trunk/src/html/gnc-html-webkit.c	2009-11-08 18:59:39 UTC (rev 18407)
+++ gnucash/trunk/src/html/gnc-html-webkit.c	2009-11-09 23:35:25 UTC (rev 18408)
@@ -79,8 +79,11 @@
 static char error_404_title[] = N_("Not found");
 static char error_404_body[] = N_("The specified URL could not be loaded.");
 
-static void webkit_navigation_requested_cb( WebKitWebView* web_view, GObject* arg1,
-												GObject* arg2, gpointer data );
+static WebKitNavigationResponse webkit_navigation_requested_cb(
+								WebKitWebView* web_view,
+								WebKitWebFrame* frame,
+								WebKitNetworkRequest* request,
+								gpointer user_data );
 static void webkit_on_url_cb( WebKitWebView* web_view, gchar* title, gchar* url,
 							gpointer data );
 static gchar* handle_embedded_object( GncHtmlWebkit* self, gchar* html_str );
@@ -476,23 +479,28 @@
  * loaded within the loading of a page (embedded image).
  ********************************************************************/
 
-static void
-webkit_navigation_requested_cb( WebKitWebView* web_view, GObject* arg1,
-												GObject* arg2, gpointer data )
+static WebKitNavigationResponse
+webkit_navigation_requested_cb( WebKitWebView* web_view, WebKitWebFrame* frame,
+								WebKitNetworkRequest* request,
+								gpointer data )
 {
 	URLType type;
 	gchar* location = NULL;
 	gchar* label = NULL;
 	GncHtmlWebkit* self = GNC_HTML_WEBKIT(data);
-	WebKitNetworkRequest* req = WEBKIT_NETWORK_REQUEST(arg2);
-	const gchar* url = webkit_network_request_get_uri( req );
+	const gchar* url = webkit_network_request_get_uri( request );
 
 	DEBUG( "requesting %s", url );
+    if( strcmp( url, "base-uri" ) == 0 ) {
+	    return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
+	}
+
 	type = gnc_html_parse_url( GNC_HTML(self), url, &location, &label );
 	gnc_html_show_url( GNC_HTML(self), type, location, label, 0 );
 //	load_to_stream( self, type, location, label );
 	g_free( location );
 	g_free( label );
+	return WEBKIT_NAVIGATION_RESPONSE_IGNORE;
 }
 
 #if 0



More information about the gnucash-changes mailing list