summaryrefslogtreecommitdiffstats
path: root/swaybar/tray/sni.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaybar/tray/sni.c')
-rw-r--r--swaybar/tray/sni.c10
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) {
160 dirty = true; 160 dirty = true;
161 161
162 dbus_message_unref(reply); 162 dbus_message_unref(reply);
163 dbus_pending_call_unref(pending);
163 return; 164 return;
164 } else { 165 } else {
165 sway_log(L_ERROR, "Could not create image surface"); 166 sway_log(L_ERROR, "Could not create image surface");
@@ -170,6 +171,7 @@ bail:
170 if (reply) { 171 if (reply) {
171 dbus_message_unref(reply); 172 dbus_message_unref(reply);
172 } 173 }
174 dbus_pending_call_unref(pending);
173 sway_log(L_ERROR, "Could not get icon from item"); 175 sway_log(L_ERROR, "Could not get icon from item");
174 return; 176 return;
175} 177}
@@ -266,6 +268,7 @@ static void reply_icon_name(DBusPendingCall *pending, void *_data) {
266 dirty = true; 268 dirty = true;
267 269
268 dbus_message_unref(reply); 270 dbus_message_unref(reply);
271 dbus_pending_call_unref(pending);
269 return; 272 return;
270 } 273 }
271 274
@@ -273,6 +276,7 @@ bail:
273 if (reply) { 276 if (reply) {
274 dbus_message_unref(reply); 277 dbus_message_unref(reply);
275 } 278 }
279 dbus_pending_call_unref(pending);
276 // Now try the pixmap 280 // Now try the pixmap
277 send_icon_msg(item); 281 send_icon_msg(item);
278 return; 282 return;
@@ -413,6 +417,12 @@ static void get_unique_name(struct StatusNotifierItem *item) {
413} 417}
414 418
415struct StatusNotifierItem *sni_create(const char *name) { 419struct StatusNotifierItem *sni_create(const char *name) {
420 // Make sure `name` is well formed
421 if (!dbus_validate_bus_name(name, NULL)) {
422 sway_log(L_INFO, "Name (%s) is not a bus name. We cannot create an item.", name);
423 return NULL;
424 }
425
416 struct StatusNotifierItem *item = malloc(sizeof(struct StatusNotifierItem)); 426 struct StatusNotifierItem *item = malloc(sizeof(struct StatusNotifierItem));
417 item->name = strdup(name); 427 item->name = strdup(name);
418 item->unique_name = NULL; 428 item->unique_name = NULL;