Skip to content

Commit

Permalink
Fix segfault destroying libdbus connection
Browse files Browse the repository at this point in the history
  • Loading branch information
robbert-vdh committed Apr 7, 2024
1 parent c50ef82 commit 8d508dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Fixed a potential segfault when unloading yabridge.

## [5.1.0] - 2023-12-23

### Added
Expand Down
12 changes: 11 additions & 1 deletion src/common/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,19 @@ std::mutex libdbus_mutex;
LIBDBUS_FUNCTIONS
#undef X

/**
* The deleter used for `libdbus_connection`. `libdbus_connection` can't
* directly reference `libdbus_connection_unref` directly because it will not
* yet have been initialized until just before `libdbus_connection` gets
* initialized.
*/
static void close_dbus_connection(DBusConnection* connection) {
libdbus_connection_unref(connection);
}

std::unique_ptr<DBusConnection, void (*)(DBusConnection*)> libdbus_connection(
nullptr,
libdbus_connection_unref);
close_dbus_connection);

/**
* Try to set up D-Bus. Returns `false` if a function could not be resolved or
Expand Down

0 comments on commit 8d508dc

Please sign in to comment.