diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | client/gdaemonfileenumerator.c | 12 |
2 files changed, 16 insertions, 3 deletions
@@ -1,5 +1,12 @@ 2008-03-26 Alexander Larsson <alexl@redhat.com> + * client/gdaemonfileenumerator.c: + (g_daemon_file_enumerator_next_file): + Avoid hanging forever and not sending any async messages. + This could happen if we raced and missed the done check. + +2008-03-26 Alexander Larsson <alexl@redhat.com> + * daemon/gvfsmonitor.c: Send replies to subscribe and unsubscribe messages. diff --git a/client/gdaemonfileenumerator.c b/client/gdaemonfileenumerator.c index 1fc8209e..3df80904 100644 --- a/client/gdaemonfileenumerator.c +++ b/client/gdaemonfileenumerator.c @@ -196,10 +196,12 @@ g_daemon_file_enumerator_next_file (GFileEnumerator *enumerator, GDaemonFileEnumerator *daemon = G_DAEMON_FILE_ENUMERATOR (enumerator); GFileInfo *info; gboolean done; + int count; info = NULL; done = FALSE; - while (1) + count = 0; + while (count < G_VFS_DBUS_TIMEOUT_MSECS / 100) { G_LOCK (infos); if (daemon->infos) @@ -219,8 +221,12 @@ g_daemon_file_enumerator_next_file (GFileEnumerator *enumerator, if (done) break; - - if (!dbus_connection_read_write_dispatch (daemon->sync_connection, -1)) + + /* We sleep only 100 msecs here, not the full time because we might have + * raced with the filter func being called after unlocking + * and setting done or ->infos. So, we want to check it again reasonaby soon. + */ + if (!dbus_connection_read_write_dispatch (daemon->sync_connection, 100)) break; } |