Index: ChangeLog =================================================================== RCS file: /cvs/dbus/dbus/ChangeLog,v retrieving revision 1.750 diff -u -p -r1.750 ChangeLog --- ChangeLog 31 Mar 2005 02:24:11 -0000 1.750 +++ ChangeLog 6 Apr 2005 02:14:15 -0000 @@ -1,3 +1,17 @@ +2005-04-05 David Zeuthen + + Fix https://bugs.freedesktop.org/show_bug.cgi?id=2889 + + * glib/dbus-gmain.c: + (io_handler_destroy_source): Remove from list of IO's of the + ConnectionSetup object and return head of list + (timeout_handler_destroy_source): -do- + (io_handler_source_destroyed): Don't remove from list since + we now do that in io_handler_destroy_source() + (timeout_handler_source_destroyed): -do- + (connection_setup_free): Use new return value from _destroy_ + source functions to iterate over all sources + 2005-03-30 Havoc Pennington * configure.in: change check to gtk 2.4 Index: glib/dbus-gmain.c =================================================================== RCS file: /cvs/dbus/dbus/glib/dbus-gmain.c,v retrieving revision 1.37 diff -u -p -r1.37 dbus-gmain.c --- glib/dbus-gmain.c 30 Jan 2005 23:06:32 -0000 1.37 +++ glib/dbus-gmain.c 6 Apr 2005 02:14:15 -0000 @@ -172,27 +172,31 @@ io_handler_source_destroyed (gpointer da handler = data; - handler->cs->ios = g_slist_remove (handler->cs->ios, handler); - if (handler->watch) dbus_watch_set_data (handler->watch, NULL, NULL); g_free (handler); } -static void +static GSList * io_handler_destroy_source (void *data) { + GSList *head; IOHandler *handler; + head = NULL; handler = data; if (handler->source) { GSource *source = handler->source; handler->source = NULL; + head = g_slist_remove (handler->cs->ios, handler); + handler->cs->ios = head; g_source_destroy (source); } + + return head; } static void @@ -310,27 +314,31 @@ timeout_handler_source_destroyed (gpoint handler = data; - handler->cs->timeouts = g_slist_remove (handler->cs->timeouts, handler); - if (handler->timeout) dbus_timeout_set_data (handler->timeout, NULL, NULL); g_free (handler); } -static void +static GSList * timeout_handler_destroy_source (void *data) { + GSList *head; TimeoutHandler *handler; + head = NULL; handler = data; if (handler->source) { GSource *source = handler->source; handler->source = NULL; + head = g_slist_remove (handler->cs->timeouts, handler); + handler->cs->timeouts = head; g_source_destroy (source); } + + return head; } static void @@ -399,11 +407,15 @@ connection_setup_remove_timeout (Connect static void connection_setup_free (ConnectionSetup *cs) { - while (cs->ios) - io_handler_destroy_source (cs->ios->data); + GSList *i; + + /* as a sideeffect, the *_destroy_source functions returns the head + * of the new list of sources so we just iterate over all of them */ + for (i = cs->ios; i != NULL; i = io_handler_destroy_source (i->data)) + ; - while (cs->timeouts) - timeout_handler_destroy_source (cs->timeouts->data); + for (i = cs->timeouts; i != NULL; i = timeout_handler_destroy_source (i->data)) + ; if (cs->message_queue_source) {