dbus: make sure we don't unref a NULL dbus connection

See #1213
This commit is contained in:
Wim Taymans 2021-05-26 10:52:38 +02:00
parent 492caf4456
commit 751f9a9ea0
2 changed files with 4 additions and 2 deletions

View file

@ -288,6 +288,7 @@ static DBusHandlerResult filter_message (DBusConnection *connection,
if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) { if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
spa_log_debug(impl->log, "dbus connection %p disconnected", this); spa_log_debug(impl->log, "dbus connection %p disconnected", this);
if (this->conn)
dbus_connection_unref(this->conn); dbus_connection_unref(this->conn);
this->conn = NULL; this->conn = NULL;
connection_emit_disconnected(this); connection_emit_disconnected(this);

View file

@ -289,6 +289,7 @@ static void session_destroy(void *data)
static void session_dbus_disconnected(void *data) static void session_dbus_disconnected(void *data)
{ {
struct impl *impl = data; struct impl *impl = data;
if (impl->bus)
dbus_connection_unref(impl->bus); dbus_connection_unref(impl->bus);
impl->bus = NULL; impl->bus = NULL;
} }