Skip to content

Commit

Permalink
Refactor: libcrmservices: Unref the dbus connection...
Browse files Browse the repository at this point in the history
...when we disconnect from the bus.  We aren't allowed to close 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.
  • Loading branch information
clumens committed Feb 5, 2025
1 parent 51a93e7 commit 4a4e721
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/services/dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,12 @@ pcmk_dbus_connect(void)
void
pcmk_dbus_disconnect(DBusConnection *connection)
{
/* Per the DBus documentation, connections created with
* dbus_connection_open() are owned by libdbus and should never be closed.
*
* @TODO Should we call dbus_connection_unref() here?
/* We acquire our dbus connection with dbus_bus_get(), which makes it a
* shared connection. Therefore, we can't close or free it here. The
* best we can do is decrement the reference count so dbus knows when
* there are no more clients connected to it.
*/
return;
dbus_connection_unref(connection);
}

// Custom DBus error names to use
Expand Down

0 comments on commit 4a4e721

Please sign in to comment.