summaryrefslogtreecommitdiffstats
path: root/glib
diff options
context:
space:
mode:
authorRichard Hult <rhult@codefactory.se>2003-01-26 00:06:30 +0000
committerRichard Hult <rhult@codefactory.se>2003-01-26 00:06:30 +0000
commit5fbace55488af10cff74218954405e4c1d0c856b (patch)
tree7532ed8e9d8ec137ab1612fa38e50f1635867fa5 /glib
parentf7867d886db5e22de10d9b5d7caccea189ad2b5d (diff)
2003-01-26 Richard Hult <rhult@codefactory.se>
* glib/dbus-gmain.c (dbus_connection_dispatch): Traverse a copy of the file descriptor list, since it can change under us.
Diffstat (limited to 'glib')
-rw-r--r--glib/dbus-gmain.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/glib/dbus-gmain.c b/glib/dbus-gmain.c
index 6697c125..5766139d 100644
--- a/glib/dbus-gmain.c
+++ b/glib/dbus-gmain.c
@@ -89,11 +89,13 @@ dbus_connection_dispatch (GSource *source,
gpointer user_data)
{
DBusGSource *dbus_source = (DBusGSource *)source;
-
- GList *list;
+ GList *copy, *list;
- list = dbus_source->poll_fds;
+ /* We need to traverse a copy of the list, since it can change in
+ dbus_connect_handle_watch. */
+ copy = g_list_copy (dbus_source->poll_fds);
+ list = copy;
while (list)
{
GPollFD *poll_fd = list->data;
@@ -114,10 +116,12 @@ dbus_connection_dispatch (GSource *source,
dbus_connection_handle_watch (dbus_source->connection, watch, condition);
}
-
+
list = list->next;
}
+ g_list_free (copy);
+
/* Dispatch messages */
while (dbus_connection_dispatch_message (dbus_source->connection));