[glib/glib-2-28] GDBusWorker: backport explanatory comment about G_IO_ERROR_CANCELLED from 2.30



commit 19d1db095daccb32796d559687aaeb23655582e4
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Thu Nov 10 19:05:33 2011 +0000

    GDBusWorker: backport explanatory comment about G_IO_ERROR_CANCELLED from 2.30
    
    This was mistakenly omitted from the 2.28 version.
    
    (cherry picked from commit d65b80fb547ef3eed80ae970f858e7d110d90b40)
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
    Bug-NB: NB#287088
    Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>
    Reviewed-by: Colin Walters <walters verbum org>

 gio/gdbusprivate.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index aee5449..5f9d107 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -704,6 +704,12 @@ _g_dbus_worker_do_read_cb (GInputStream  *input_stream,
 
   if (bytes_read == -1)
     {
+      /* Every async read that uses this callback uses worker->cancellable
+       * as its GCancellable. worker->cancellable gets cancelled if and only
+       * if the GDBusConnection tells us to close (either via
+       * _g_dbus_worker_stop, which is called on last-unref, or directly),
+       * so a cancelled read must mean our connection was closed locally.
+       */
       if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
         _g_dbus_worker_emit_disconnected (worker, FALSE, NULL);
       else



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