From b3fcb1442e81d14846a8b5d2e33352ac0f6d48ea Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 5 Aug 2015 13:25:47 +0200 Subject: [PATCH] gdbus: Don't use g_assert_no_error() GDBusObjectManagerServer There are real world cases where emitting signals can fail, such as if the DBus connection closes. Asserting and aborting the process in these cases is just plain lazy. Ignore the errors when the connection is closed, and turn the others into warnings. https://bugzilla.gnome.org/show_bug.cgi?id=753278 --- gio/gdbusobjectmanagerserver.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gio/gdbusobjectmanagerserver.c b/gio/gdbusobjectmanagerserver.c index bb6f8c23e..6745df0f1 100644 --- a/gio/gdbusobjectmanagerserver.c +++ b/gio/gdbusobjectmanagerserver.c @@ -30,6 +30,8 @@ #include "gdbusmethodinvocation.h" #include "gdbuserror.h" +#include "gioerror.h" + #include "glibintl.h" /** @@ -927,7 +929,11 @@ g_dbus_object_manager_server_emit_interfaces_added (GDBusObjectManagerServer *ma object_path, &array_builder), &error); - g_assert_no_error (error); + if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED)) + { + g_warning ("Couldn't emit InterfacesAdded signal: %s", error->message); + g_error_free (error); + } out: ; } @@ -960,7 +966,11 @@ g_dbus_object_manager_server_emit_interfaces_removed (GDBusObjectManagerServer * object_path, &array_builder), &error); - g_assert_no_error (error); + if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED)) + { + g_warning ("Couldn't emit InterfacesRemoved signal: %s", error->message); + g_error_free (error); + } out: ; }