mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
core-util: Fix set_nice() to use private bus connections
In src/pulsecore/core-util.c:set_nice() we currently use a temporary dbus-connection to set the nice-level via rtkit. However, we never close that connection. This is fine, as the connection is shared and dbus-core will manage it. But no other part of pulseaudio (except set_scheduler()) uses the libdbus1 managed connections. Therefore, we effectively end up with an unused dbus-connection that is not integrated into any main-loop. dbus-daemon will send bus-notifications to the connection (as libdbus1 installs matches for those by default (it has to!)) until the outgoing queue is full. Thus, we waste several KBs (or MBs? I didn't look it up) of memory for a message queue that is never dispatched. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
parent
a13b6f001d
commit
b8bcfeb78d
1 changed files with 2 additions and 1 deletions
|
|
@ -860,7 +860,7 @@ static int set_nice(int nice_level) {
|
||||||
#ifdef HAVE_DBUS
|
#ifdef HAVE_DBUS
|
||||||
/* Try to talk to RealtimeKit */
|
/* Try to talk to RealtimeKit */
|
||||||
|
|
||||||
if (!(bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error))) {
|
if (!(bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error))) {
|
||||||
pa_log("Failed to connect to system bus: %s\n", error.message);
|
pa_log("Failed to connect to system bus: %s\n", error.message);
|
||||||
dbus_error_free(&error);
|
dbus_error_free(&error);
|
||||||
errno = -EIO;
|
errno = -EIO;
|
||||||
|
|
@ -873,6 +873,7 @@ static int set_nice(int nice_level) {
|
||||||
dbus_connection_set_exit_on_disconnect(bus, FALSE);
|
dbus_connection_set_exit_on_disconnect(bus, FALSE);
|
||||||
|
|
||||||
r = rtkit_make_high_priority(bus, 0, nice_level);
|
r = rtkit_make_high_priority(bus, 0, nice_level);
|
||||||
|
dbus_connection_close(bus);
|
||||||
dbus_connection_unref(bus);
|
dbus_connection_unref(bus);
|
||||||
|
|
||||||
if (r >= 0) {
|
if (r >= 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue