Don't free the hosts while holding host_lock; that's not allowed and can
authorDan Winship <danw@src.gnome.org>
Mon, 22 May 2006 14:47:30 +0000 (14:47 +0000)
committerDan Winship <danw@src.gnome.org>
Mon, 22 May 2006 14:47:30 +0000 (14:47 +0000)
        * libsoup/soup-session.c (cleanup_hosts): Don't free the hosts
        while holding host_lock; that's not allowed and can cause
        deadlock. #309867. Based on a patch from Veerapuram Varadhan for
        part of bnc #174255.

ChangeLog
libsoup/soup-session.c

index c444f73..e5f4757 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-05-22  Dan Winship  <danw@novell.com>
+
+       * libsoup/soup-session.c (cleanup_hosts): Don't free the hosts
+       while holding host_lock; that's not allowed and can cause
+       deadlock. #309867. Based on a patch from Veerapuram Varadhan for
+       part of bnc #174255.
+
 2006-04-10  Dan Winship  <danw@novell.com>
 
        * configure.in: bump version to 2.2.92
index 95594b8..480e618 100644 (file)
@@ -139,9 +139,15 @@ foreach_free_host (gpointer key, gpointer host, gpointer data)
 static void
 cleanup_hosts (SoupSessionPrivate *priv)
 {
+       GHashTable *old_hosts;
+
        g_mutex_lock (priv->host_lock);
-       g_hash_table_foreach_remove (priv->hosts, foreach_free_host, NULL);
+       old_hosts = priv->hosts;
+       priv->hosts = g_hash_table_new (host_uri_hash, host_uri_equal);
        g_mutex_unlock (priv->host_lock);
+
+       g_hash_table_foreach_remove (old_hosts, foreach_free_host, NULL);
+       g_hash_table_destroy (old_hosts);
 }
 
 static void