[glib/glib-2-30] GDBusWorker: continue_writing: initialize flush_async_data if closing



commit a8ee10cc7d10cfe8e23938b48b22430e10cc01f5
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Wed Nov 23 11:20:15 2011 +0000

    GDBusWorker: continue_writing: initialize flush_async_data if closing
    
    This was a regression in commits f41178c6c and d0d04c09: flush_async_data
    wasn't necessarily NULL in the "don't flush" case.
    
    Also move initialization of these variables up so that it's
    unconditional, since that's easier to verify than checking
    that each branch gets it right.
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=664617
    Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>

 gio/gdbusprivate.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index 7f0d6f8..d77ab83 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -1444,6 +1444,9 @@ continue_writing (GDBusWorker *worker)
 
   g_mutex_lock (worker->write_lock);
 
+  data = NULL;
+  flush_async_data = NULL;
+
   /* if we want to close the connection, that takes precedence */
   if (worker->pending_close_attempts != NULL)
     {
@@ -1453,7 +1456,6 @@ continue_writing (GDBusWorker *worker)
       g_io_stream_close_async (worker->stream, G_PRIORITY_DEFAULT,
                                NULL, iostream_close_cb,
                                _g_dbus_worker_ref (worker));
-      data = NULL;
     }
   else
     {
@@ -1466,10 +1468,6 @@ continue_writing (GDBusWorker *worker)
           if (data != NULL)
             worker->output_pending = PENDING_WRITE;
         }
-      else
-        {
-          data = NULL;
-        }
     }
 
   g_mutex_unlock (worker->write_lock);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]