fix(tray): free icon data on pixbuf update

pull/252/head
Aleksei Bavshin 2019-03-27 19:56:19 -07:00
parent 7bd5454e43
commit 842e8501f9
1 changed files with 7 additions and 1 deletions

View File

@ -115,6 +115,11 @@ void waybar::modules::SNI::Item::getAll(GObject *obj, GAsyncResult *res,
// TODO: handle change // TODO: handle change
} }
static void
pixbuf_data_deleter(const guint8* data) {
g_free((void*) data);
}
Glib::RefPtr<Gdk::Pixbuf> Glib::RefPtr<Gdk::Pixbuf>
waybar::modules::SNI::Item::extractPixBuf(GVariant *variant) { waybar::modules::SNI::Item::extractPixBuf(GVariant *variant) {
GVariantIter *it; GVariantIter *it;
@ -158,7 +163,8 @@ waybar::modules::SNI::Item::extractPixBuf(GVariant *variant) {
array[i + 3] = alpha; array[i + 3] = alpha;
} }
return Gdk::Pixbuf::create_from_data(array, Gdk::Colorspace::COLORSPACE_RGB, return Gdk::Pixbuf::create_from_data(array, Gdk::Colorspace::COLORSPACE_RGB,
true, 8, lwidth, lheight, 4 * lwidth); true, 8, lwidth, lheight, 4 * lwidth,
&pixbuf_data_deleter);
} }
return Glib::RefPtr<Gdk::Pixbuf>{}; return Glib::RefPtr<Gdk::Pixbuf>{};
} }