[glib/wip/hadess/add-dbus-tests-debug] gdbus: Fix runtime warning with debug enabled



commit 145dc5a49ee78e8d6a69360d598f055e7929b109
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 11 11:38:24 2019 +0100

    gdbus: Fix runtime warning with debug enabled
    
    With debug enabled, g_dbus_connection_call_done() will throw a
    g_warning() if the call failed (on purpose or not) while trying to the
    serial of a non-existant reply.
    
    (/builds/GNOME/glib/_build/gio/tests/gdbus-connection:26921): GLib-GIO-CRITICAL **: 10:10:16.311: 
g_dbus_message_get_reply_serial: assertion 'G_IS_DBUS_MESSAGE (message)' failed

 gio/gdbusconnection.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index 3411033f3..dbfc53953 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -5726,17 +5726,19 @@ g_dbus_connection_call_done (GObject      *source,
       _g_dbus_debug_print_lock ();
       g_print ("========================================================================\n"
                "GDBus-debug:Call:\n"
-               " <<<< ASYNC COMPLETE %s() (serial %d)\n"
-               "      ",
-               state->method_name,
-               g_dbus_message_get_reply_serial (reply));
+               " <<<< ASYNC COMPLETE %s()",
+               state->method_name);
+
       if (reply != NULL)
         {
-          g_print ("SUCCESS\n");
+          g_print (" (serial %d)\n"
+                   "      SUCCESS\n",
+                   g_dbus_message_get_reply_serial (reply));
         }
       else
         {
-          g_print ("FAILED: %s\n",
+          g_print ("\n"
+                   "      FAILED: %s\n",
                    error->message);
         }
       _g_dbus_debug_print_unlock ();


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