Don't run the queue again if the callback destroyed the session. #511868,
authorDan Winship <danw@src.gnome.org>
Sun, 27 Jan 2008 16:52:35 +0000 (16:52 +0000)
committerDan Winship <danw@src.gnome.org>
Sun, 27 Jan 2008 16:52:35 +0000 (16:52 +0000)
* libsoup/soup-session-async.c (final_finished): Don't run the
queue again if the callback destroyed the session. #511868, Stef
Walter.

svn path=/trunk/; revision=1053

ChangeLog
libsoup/soup-session-async.c

index b5c2a3e..0c96757 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-27  Dan Winship  <danw@gnome.org>
+
+       * libsoup/soup-session-async.c (final_finished): Don't run the
+       queue again if the callback destroyed the session. #511868, Stef
+       Walter.
+
 2008-01-25  Srinivasa Ragavan  <sragavan@novell.com>
 
        ** Fix for bug #511980
index a383900..2317cec 100644 (file)
@@ -196,18 +196,24 @@ final_finished (SoupMessage *req, gpointer user_data)
        SoupSessionAsyncQueueData *saqd = user_data;
        SoupSessionAsync *sa = saqd->sa;
 
+       g_object_add_weak_pointer (G_OBJECT (sa), (gpointer)&sa);
+
        if (!SOUP_MESSAGE_IS_STARTING (req)) {
                g_signal_handlers_disconnect_by_func (req, final_finished, saqd);
                if (saqd->callback) {
                        saqd->callback ((SoupSession *)sa, req,
                                        saqd->callback_data);
+                       /* callback might destroy sa */
                }
 
                g_object_unref (req);
                g_slice_free (SoupSessionAsyncQueueData, saqd);
        }
 
-       run_queue (sa, FALSE);
+       if (sa) {
+               g_object_remove_weak_pointer (G_OBJECT (sa), (gpointer)&sa);
+               run_queue (sa, FALSE);
+       }
 }
 
 static gboolean