[glib/glib-2-28] GDBusWorker: if a read was cancelled it means we closed the connection



commit ac2c49f313c7b74ef593b779a1c7207295d3c4bc
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Tue Oct 18 15:21:38 2011 +0100

    GDBusWorker: if a read was cancelled it means we closed the connection
    
    This was a regression caused by my previous work on GDBusWorker thread-safety
    (Bug #651268). The symptom is that if you disconnect a GDBusConnection
    locally, the default implementation of GDBusConnection::closed
    terminates your process, even though it shouldn't do that for
    locally-closed connections; this is because GDBusWorker didn't think a
    cancelled read was a local close.
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
    Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>

 gio/gdbusprivate.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index ea902c6..aee5449 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -704,7 +704,11 @@ _g_dbus_worker_do_read_cb (GInputStream  *input_stream,
 
   if (bytes_read == -1)
     {
-      _g_dbus_worker_emit_disconnected (worker, TRUE, error);
+      if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+        _g_dbus_worker_emit_disconnected (worker, FALSE, NULL);
+      else
+        _g_dbus_worker_emit_disconnected (worker, TRUE, error);
+
       g_error_free (error);
       goto out;
     }



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