aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/tray/dbus.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaybar/tray/dbus.c')
-rw-r--r--swaybar/tray/dbus.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/swaybar/tray/dbus.c b/swaybar/tray/dbus.c
index 22531aa6..8e719fd9 100644
--- a/swaybar/tray/dbus.c
+++ b/swaybar/tray/dbus.c
@@ -1,4 +1,4 @@
1#define _XOPEN_SOURCE 500 1#define _XOPEN_SOURCE 700
2#include <stdio.h> 2#include <stdio.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#include <stdint.h> 4#include <stdint.h>
@@ -108,7 +108,7 @@ static dbus_bool_t add_timeout(DBusTimeout *timeout, void *_data) {
108 108
109 timer_settime(*timer, 0, &time, NULL); 109 timer_settime(*timer, 0, &time, NULL);
110 110
111 dbus_timeout_set_data(timeout, timer, free); 111 dbus_timeout_set_data(timeout, timer, NULL);
112 112
113 sway_log(L_DEBUG, "Adding DBus timeout. Interval: %ds %dms", interval_sec, interval_msec); 113 sway_log(L_DEBUG, "Adding DBus timeout. Interval: %ds %dms", interval_sec, interval_msec);
114 add_timer(*timer, dispatch_timeout, timeout); 114 add_timer(*timer, dispatch_timeout, timeout);
@@ -121,6 +121,8 @@ static void remove_timeout(DBusTimeout *timeout, void *_data) {
121 121
122 if (timer) { 122 if (timer) {
123 remove_timer(*timer); 123 remove_timer(*timer);
124 timer_delete(*timer);
125 free(timer);
124 } 126 }
125} 127}
126 128
@@ -136,7 +138,7 @@ static void dispatch_status(DBusConnection *connection, DBusDispatchStatus new_s
136/* Public functions below */ 138/* Public functions below */
137 139
138void dispatch_dbus() { 140void dispatch_dbus() {
139 if (!should_dispatch) { 141 if (!should_dispatch || !conn) {
140 return; 142 return;
141 } 143 }
142 144