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
This commit is contained in:
Stef Walter 2015-08-05 13:25:47 +02:00
parent 46cf19c447
commit b3fcb1442e

View File

@ -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:
;
}