GNOME Bugzilla – Bug 715157
GDBusObjectManager doesn't check if GDBusConnection is actually open
Last modified: 2018-05-24 16:04:37 UTC
So, I'm doing some unit tests with ModemManager, using the GTestDBus support. ModemManager uses the GDBusObjectManager implementation from GDBus. The thing is, that when g_test_dbus_down() is called, the GDBusConnection will get closed in the ModemManager service, but due to MM's behaviour the object implementing the ObjectManager interface will try to cleanup all the objects it handles (e.g. to cleanly close the modem control protocol), and part of the logic will involve removing interfaces from DBus. When that happens, I will end up getting the following assertion: GLib-GIO:ERROR:gdbusobjectmanagerserver.c:966:g_dbus_object_manager_server_emit_interfaces_removed: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18) The GDBusObjectManager keeps a GDBusConnection reference around, but when wanting to emit e.g. interface-removed (g_dbus_object_manager_server_emit_interfaces_removed), it assumes that if the GDBusConnection exists it will be open: if (data->manager->priv->connection == NULL) goto out; else... emit signal Shouldn't the logic check not only for a valid GDBusConnection, but also for it being *open* (e.g. with g_dbus_connection_is_closed())? Of course this case is very specific, as it really is about the bus disappearing during a test and MM trying to cleanup stuff even after having lost the well-known name, but anyway... I guess that to avoid this issue I can always set connection to NULL as soon as get the name lost signal, but still, I believe this could be a valid bug, unless I'm missing something.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/795.