=== modified file 'gio/gdbusprivate.c'
--- gio/gdbusprivate.c	2010-11-09 15:17:03 +0000
+++ gio/gdbusprivate.c	2010-11-23 17:03:56 +0000
@@ -430,6 +430,7 @@
   gint                                num_writes_pending;
   guint64                             write_num_messages_written;
   GList                              *write_pending_flushes;
+  gboolean                            flush_pending;
 };
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -1155,6 +1156,12 @@
   if (error != NULL)
     g_error_free (error);
 
+  /* Make sure we tell folks that we don't have additional
+     flushes pending */
+  g_mutex_lock (data->worker->write_lock);
+  data->worker->flush_pending = FALSE;
+  g_mutex_unlock (data->worker->write_lock);
+
   /* OK, cool, finally kick off the next write */
   maybe_write_next_message (data->worker);
 
@@ -1207,6 +1214,10 @@
           worker->write_pending_flushes = g_list_delete_link (worker->write_pending_flushes, l);
         }
     }
+  if (flushers != NULL)
+    {
+      worker->flush_pending = TRUE;
+    }
   g_mutex_unlock (worker->write_lock);
 
   if (flushers != NULL)
@@ -1341,7 +1352,7 @@
 write_message_in_idle_cb (gpointer user_data)
 {
   GDBusWorker *worker = user_data;
-  if (worker->num_writes_pending == 0)
+  if (worker->num_writes_pending == 0 && !worker->flush_pending)
     maybe_write_next_message (worker);
   return FALSE;
 }
@@ -1424,6 +1435,7 @@
   worker->stream = g_object_ref (stream);
   worker->capabilities = capabilities;
   worker->cancellable = g_cancellable_new ();
+  worker->flush_pending = FALSE;
 
   worker->frozen = initially_frozen;
   worker->received_messages_while_frozen = g_queue_new ();

