Browse Source

fix(systemtrayicon): don't set an invalid and useless icon on GTK

* The initial status icon to set on GTK didn't exist (anymore?).
* GTK resources aren't compatible with Qt's, so the resource lookup
  couldn't work anyway, even if it did exist.
* The caller calls SystemTryIcon::setIcon() right after instancing it
  anyway, so there's no need for an initial icon.

This fixes a runtime critical warning from GTK as we tried to unref a
NULL icon, which is invalid.

Fixes #3154.
pull/3390/head
Colomban Wendling 9 years ago
parent
commit
a13c566736
  1. 5
      src/widget/systemtrayicon.cpp

5
src/widget/systemtrayicon.cpp

@ -66,10 +66,7 @@ SystemTrayIcon::SystemTrayIcon() @@ -66,10 +66,7 @@ SystemTrayIcon::SystemTrayIcon()
backendType = SystrayBackendType::GTK;
gtk_init(nullptr, nullptr);
// No ':' needed in resource path!
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_resource("/img/icon.png", NULL);
gtkIcon = gtk_status_icon_new_from_pixbuf(pixbuf);
g_object_unref(pixbuf);
gtkIcon = gtk_status_icon_new();
gtkMenu = gtk_menu_new();

Loading…
Cancel
Save