[Xfce4-commits] <midori:master> Fix sokoke_prefetch_uri hanging forever with WebKit2

Christian Dywan noreply at xfce.org
Thu Apr 11 23:10:03 CEST 2013


Updating branch refs/heads/master
         to 92c39ecd64bb547b35955665d249d4507af3c9c9 (commit)
       from cdc01c0ad8be0202ee25d26ed58e9f95bd343d42 (commit)

commit 92c39ecd64bb547b35955665d249d4507af3c9c9
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Apr 11 22:38:19 2013 +0200

    Fix sokoke_prefetch_uri hanging forever with WebKit2

 midori/sokoke.c |   16 +++++++---------
 midori/sokoke.h |    6 +-----
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/midori/sokoke.c b/midori/sokoke.c
index 04940b3..c10ae02 100644
--- a/midori/sokoke.c
+++ b/midori/sokoke.c
@@ -457,7 +457,7 @@ sokoke_resolve_hostname (const gchar* hostname)
     gint host_resolved = 0;
 
     uri = g_strconcat ("http://", hostname, NULL);
-    if (sokoke_prefetch_uri (NULL, uri, sokoke_resolve_hostname_cb,
+    if (sokoke_prefetch_uri (NULL, uri, G_CALLBACK (sokoke_resolve_hostname_cb),
                              &host_resolved))
     {
         GTimer* timer = g_timer_new ();
@@ -954,11 +954,7 @@ sokoke_gtk_action_count_modifiers (GtkAction* action)
 gboolean
 sokoke_prefetch_uri (MidoriWebSettings*  settings,
                      const char*         uri,
-#ifndef HAVE_WEBKIT2
-                     SoupAddressCallback callback,
-#else
-                     void*               callback,
-#endif
+                     GCallback           callback,
                      gpointer            user_data)
 {
     #define MAXHOSTS 50
@@ -980,6 +976,8 @@ sokoke_prefetch_uri (MidoriWebSettings*  settings,
 #ifdef HAVE_WEBKIT2
     WebKitWebContext* context = webkit_web_context_get_default ();
     webkit_web_context_prefetch_dns (context, hostname);
+    g_free (hostname);
+    return FALSE;
 #else
     if (!hosts ||
         !g_regex_match_simple (hostname, hosts,
@@ -989,7 +987,7 @@ sokoke_prefetch_uri (MidoriWebSettings*  settings,
         gchar* new_hosts;
 
         address = soup_address_new (hostname, SOUP_ADDRESS_ANY_PORT);
-        soup_address_resolve_async (address, 0, 0, callback, user_data);
+        soup_address_resolve_async (address, 0, 0, (SoupAddressCallback)callback, user_data);
         g_object_unref (address);
 
         if (host_count > MAXHOSTS)
@@ -1002,10 +1000,10 @@ sokoke_prefetch_uri (MidoriWebSettings*  settings,
         katze_assign (hosts, new_hosts);
     }
     else if (callback)
-        callback (NULL, SOUP_STATUS_OK, user_data);
-#endif
+        ((SoupAddressCallback)callback) (NULL, SOUP_STATUS_OK, user_data);
     g_free (hostname);
     return TRUE;
+#endif
 }
 
 /**
diff --git a/midori/sokoke.h b/midori/sokoke.h
index b7acae4..1b2f235 100644
--- a/midori/sokoke.h
+++ b/midori/sokoke.h
@@ -109,11 +109,7 @@ sokoke_gtk_action_count_modifiers       (GtkAction* action);
 gboolean
 sokoke_prefetch_uri                     (MidoriWebSettings*  settings,
                                          const char*         uri,
-#ifndef HAVE_WEBKIT2
-                                         SoupAddressCallback callback,
-#else
-                                         void*               callback,
-#endif
+                                         GCallback           callback,
                                          gpointer            user_data);
 
 gboolean


More information about the Xfce4-commits mailing list