aboutsummaryrefslogtreecommitdiff
path: root/swaybar/ipc.c
diff options
context:
space:
mode:
authorFurkan Sahin <furkansahin824@proton.me>2024-09-25 06:35:30 -0500
committerSimon Ser <contact@emersion.fr>2024-09-28 16:23:21 +0200
commit00e9a941523baa4afa1f9c077235aa7aa5e8aeab (patch)
tree1107e55b125e0ce45a342e3a0ffed85c1af19bed /swaybar/ipc.c
parent63345977e2c411359a049c40cf2c1044a22b4f4a (diff)
swaybar: Fix 100% cpu usage if dbus dies.
Currently, swaybar does not gracefully die if it detects that the dbus connection was lost. Although it's not recommended to restart dbus without restarting the compositor, it can very easily happen. In the case it does, compositor's tray should not consume 100% cpu until it has to be force killed. apply suggestions just setting the bar to not running will call teardown and unref the dbus.
Diffstat (limited to 'swaybar/ipc.c')
-rw-r--r--swaybar/ipc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/swaybar/ipc.c b/swaybar/ipc.c
index 03500bdf..71c9a4c5 100644
--- a/swaybar/ipc.c
+++ b/swaybar/ipc.c
@@ -518,8 +518,7 @@ static bool handle_barconfig_update(struct swaybar *bar, const char *payload,
#if HAVE_TRAY
if (oldcfg->tray_hidden && !newcfg->tray_hidden) {
bar->tray = create_tray(bar);
- loop_add_fd(bar->eventloop, bar->tray->fd, POLLIN, tray_in,
- bar->tray->bus);
+ loop_add_fd(bar->eventloop, bar->tray->fd, POLLIN, tray_in, bar);
} else if (bar->tray && newcfg->tray_hidden) {
loop_remove_fd(bar->eventloop, bar->tray->fd);
destroy_tray(bar->tray);