GNOME Bugzilla – Bug 674717
g_dbus_connection_register_object can return 0 and a NULL error
Last modified: 2012-04-24 14:23:25 UTC
g_dbus_connection_register_object() will return 0 and a NULL error when one of the tests at its beginning fails: g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), 0); g_return_val_if_fail (object_path != NULL && g_variant_is_object_path (object_path), 0); g_return_val_if_fail (interface_info != NULL, 0); g_return_val_if_fail (g_dbus_is_interface_name (interface_info->name), 0); g_return_val_if_fail (check_initialized (connection), 0); But the documentation states: * Returns: 0 if @error is set, otherwise a registration id (never 0) * that can be used with g_dbus_connection_unregister_object()
If one of these tests fail, it means you are using the API incorrectly and a warning is printed on stderr. In this case (a so-called programmer error), it is customary and intentional to not set the GError - you will see the same behavior all over GLib. And it is even spelled out in the docs that GError should only be used for recoverable run-time errors, not programmer errors http://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#glib-Error-Reporting.description