gapplication: Add postconditions on calls to GApplication.dbus_register

Try and catch programmer errors in third-party implementations of
`dbus_register()`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1188
This commit is contained in:
Philip Withnall 2017-11-17 11:02:35 +00:00 committed by Philip Withnall
parent 819409cf9a
commit 539621d2d3

View File

@ -371,6 +371,7 @@ g_application_impl_attempt_primary (GApplicationImpl *impl,
GApplicationFlags app_flags; GApplicationFlags app_flags;
GVariant *reply; GVariant *reply;
guint32 rval; guint32 rval;
GError *local_error = NULL;
if (org_gtk_Application == NULL) if (org_gtk_Application == NULL)
{ {
@ -430,8 +431,14 @@ g_application_impl_attempt_primary (GApplicationImpl *impl,
if (!app_class->dbus_register (impl->app, if (!app_class->dbus_register (impl->app,
impl->session_bus, impl->session_bus,
impl->object_path, impl->object_path,
error)) &local_error))
return FALSE; {
g_return_val_if_fail (local_error != NULL, FALSE);
g_propagate_error (error, g_steal_pointer (&local_error));
return FALSE;
}
g_return_val_if_fail (local_error == NULL, FALSE);
if (impl->bus_name == NULL) if (impl->bus_name == NULL)
{ {