Skip to content

Commit 8701826

Browse files
committed
Refactor: libcrmservices: Unref the dbus connection...
...when we disconnect from the bus. We aren't allowed to free the connection since we acquired it with dbus_bus_get which makes it a shared connection. So, this is the best cleanup we can do.
1 parent 5772326 commit 8701826

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/services/dbus.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,11 @@ pcmk_dbus_connect(void)
294294
void
295295
pcmk_dbus_disconnect(DBusConnection *connection)
296296
{
297-
/* Per the DBus documentation, connections created with
298-
* dbus_connection_open() are owned by libdbus and should never be closed.
299-
*
300-
* @TODO Should we call dbus_connection_unref() here?
297+
/* DBus connections created with dbus_connection_open() are owned by
298+
* libdbus so we shouldn't close them. However, we should unref the
299+
* connection so libdbus does eventually clean it up.
301300
*/
302-
return;
301+
dbus_connection_unref(connection);
303302
}
304303

305304
// Custom DBus error names to use

0 commit comments

Comments
 (0)