1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

systemtrayicon: image is now stack-allocated

This commit is contained in:
Dmytro Shynkevych 2015-09-30 18:00:25 -04:00
parent fc41cded7f
commit 7b1b4655a5

View File

@ -107,14 +107,12 @@ SystemTrayIcon::SystemTrayIcon()
{
delete reinterpret_cast<QImage*>(image);
};
QImage* image = new QImage(":/img/icon.png");
if (image->format() != QImage::Format_RGBA8888_Premultiplied)
*image = image->convertToFormat(QImage::Format_RGBA8888_Premultiplied);
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(image->bits(), GDK_COLORSPACE_RGB, image->hasAlphaChannel(),
8, image->width(), image->height(),
image->bytesPerLine(), callbackFreeImage, image);
delete image; // Not needed anymore.
QImage image(":/img/icon.png");
if (image.format() != QImage::Format_RGBA8888_Premultiplied)
image = image.convertToFormat(QImage::Format_RGBA8888_Premultiplied);
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(image.bits(), GDK_COLORSPACE_RGB, image.hasAlphaChannel(),
8, image.width(), image.height(),
image.bytesPerLine(), callbackFreeImage, &image);
statusNotifier = status_notifier_new_from_pixbuf("qtox",
STATUS_NOTIFIER_CATEGORY_APPLICATION_STATUS, pixbuf);