mirror of
https://github.com/swaywm/sway.git
synced 2024-11-23 00:11:28 +00:00
Fix memory leaks in swaybar tray
This commit is contained in:
parent
5675a42def
commit
e8f589c3dc
|
@ -105,6 +105,7 @@ static int timer_item_timer_cmp(const void *_timer_item, const void *_timer) {
|
||||||
bool remove_timer(timer_t timer) {
|
bool remove_timer(timer_t timer) {
|
||||||
int index = list_seq_find(event_loop.timers, timer_item_timer_cmp, &timer);
|
int index = list_seq_find(event_loop.timers, timer_item_timer_cmp, &timer);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
free(event_loop.timers->items[index]);
|
||||||
list_del(event_loop.timers, index);
|
list_del(event_loop.timers, index);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ static dbus_bool_t add_timeout(DBusTimeout *timeout, void *_data) {
|
||||||
|
|
||||||
timer_settime(*timer, 0, &time, NULL);
|
timer_settime(*timer, 0, &time, NULL);
|
||||||
|
|
||||||
dbus_timeout_set_data(timeout, timer, free);
|
dbus_timeout_set_data(timeout, timer, NULL);
|
||||||
|
|
||||||
sway_log(L_DEBUG, "Adding DBus timeout. Interval: %ds %dms", interval_sec, interval_msec);
|
sway_log(L_DEBUG, "Adding DBus timeout. Interval: %ds %dms", interval_sec, interval_msec);
|
||||||
add_timer(*timer, dispatch_timeout, timeout);
|
add_timer(*timer, dispatch_timeout, timeout);
|
||||||
|
@ -121,6 +121,8 @@ static void remove_timeout(DBusTimeout *timeout, void *_data) {
|
||||||
|
|
||||||
if (timer) {
|
if (timer) {
|
||||||
remove_timer(*timer);
|
remove_timer(*timer);
|
||||||
|
timer_delete(*timer);
|
||||||
|
free(timer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,7 @@ static void reply_icon(DBusPendingCall *pending, void *_data) {
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
|
dbus_pending_call_unref(pending);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
sway_log(L_ERROR, "Could not create image surface");
|
sway_log(L_ERROR, "Could not create image surface");
|
||||||
|
@ -170,6 +171,7 @@ bail:
|
||||||
if (reply) {
|
if (reply) {
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
}
|
}
|
||||||
|
dbus_pending_call_unref(pending);
|
||||||
sway_log(L_ERROR, "Could not get icon from item");
|
sway_log(L_ERROR, "Could not get icon from item");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -266,6 +268,7 @@ static void reply_icon_name(DBusPendingCall *pending, void *_data) {
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
|
dbus_pending_call_unref(pending);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,6 +276,7 @@ bail:
|
||||||
if (reply) {
|
if (reply) {
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
}
|
}
|
||||||
|
dbus_pending_call_unref(pending);
|
||||||
// Now try the pixmap
|
// Now try the pixmap
|
||||||
send_icon_msg(item);
|
send_icon_msg(item);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -99,6 +99,7 @@ static void get_items_reply(DBusPendingCall *pending, void *_data) {
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
|
dbus_pending_call_unref(pending);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
static void get_items() {
|
static void get_items() {
|
||||||
|
|
Loading…
Reference in a new issue