From df3de6837a35517f50e2ddd65b82c86c02a35a22 Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Fri, 11 Mar 2011 09:26:01 -0600 Subject: [PATCH] Fix removal of old io and timeout handlers when switching GMainContexts Fixes http://bugs.freedesktop.org/show_bug.cgi?id=35115 --- dbus/dbus-gmain.c | 16 +++++----------- 1 files changed, 5 insertions(+), 11 deletions(-) diff --git a/dbus/dbus-gmain.c b/dbus/dbus-gmain.c index 6823d5c..5109bc8 100644 --- a/dbus/dbus-gmain.c +++ b/dbus/dbus-gmain.c @@ -500,31 +500,25 @@ static ConnectionSetup* connection_setup_new_from_old (GMainContext *context, ConnectionSetup *old) { - GSList *tmp; ConnectionSetup *cs; g_assert (old->context != context); cs = connection_setup_new (context, old->connection); - tmp = old->ios; - while (tmp != NULL) + while (old->ios != NULL) { - IOHandler *handler = tmp->data; + IOHandler *handler = old->ios->data; connection_setup_add_watch (cs, handler->watch); - - tmp = tmp->next; + /* The old handler will be removed from old->ios as a side-effect */ } - tmp = old->timeouts; - while (tmp != NULL) + while (old->timeouts != NULL) { - TimeoutHandler *handler = tmp->data; + TimeoutHandler *handler = old->timeouts->data; connection_setup_add_timeout (cs, handler->timeout); - - tmp = tmp->next; } return cs; -- 1.7.1