diff options
Diffstat (limited to 'swaybar/tray/sni.c')
-rw-r--r-- | swaybar/tray/sni.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/swaybar/tray/sni.c b/swaybar/tray/sni.c index 0c46d5c0..c9d00657 100644 --- a/swaybar/tray/sni.c +++ b/swaybar/tray/sni.c @@ -160,6 +160,7 @@ static void reply_icon(DBusPendingCall *pending, void *_data) { dirty = true; dbus_message_unref(reply); + dbus_pending_call_unref(pending); return; } else { sway_log(L_ERROR, "Could not create image surface"); @@ -170,6 +171,7 @@ bail: if (reply) { dbus_message_unref(reply); } + dbus_pending_call_unref(pending); sway_log(L_ERROR, "Could not get icon from item"); return; } @@ -266,6 +268,7 @@ static void reply_icon_name(DBusPendingCall *pending, void *_data) { dirty = true; dbus_message_unref(reply); + dbus_pending_call_unref(pending); return; } @@ -273,6 +276,7 @@ bail: if (reply) { dbus_message_unref(reply); } + dbus_pending_call_unref(pending); // Now try the pixmap send_icon_msg(item); return; @@ -413,6 +417,12 @@ static void get_unique_name(struct StatusNotifierItem *item) { } struct StatusNotifierItem *sni_create(const char *name) { + // Make sure `name` is well formed + if (!dbus_validate_bus_name(name, NULL)) { + sway_log(L_INFO, "Name (%s) is not a bus name. We cannot create an item.", name); + return NULL; + } + struct StatusNotifierItem *item = malloc(sizeof(struct StatusNotifierItem)); item->name = strdup(name); item->unique_name = NULL; |