diff --git a/src/platform/statusnotifier/statusnotifier.c b/src/platform/statusnotifier/statusnotifier.c index 2b672d301..084ab9f7a 100644 --- a/src/platform/statusnotifier/statusnotifier.c +++ b/src/platform/statusnotifier/statusnotifier.c @@ -1490,8 +1490,8 @@ method_call (GDBusConnection *conn, g_dbus_method_invocation_return_value (invocation, NULL); } -static GVariantBuilder * -get_builder_for_icon_pixmap (StatusNotifier *sn, StatusNotifierIcon icon) +static GVariant * +get_icon_pixmap (StatusNotifier *sn, StatusNotifierIcon icon) { StatusNotifierPrivate *priv = sn->priv; GVariantBuilder *builder; @@ -1535,7 +1535,11 @@ get_builder_for_icon_pixmap (StatusNotifier *sn, StatusNotifierIcon icon) (GDestroyNotify) cairo_surface_destroy, surface)); g_variant_builder_close (builder); - return builder; + GVariant *pixmap = g_variant_new ("a(iiay)", builder); + + g_variant_builder_unref(builder); // Allow the builder to be deallocated + + return pixmap; } static GVariant * @@ -1585,22 +1589,19 @@ get_prop (GDBusConnection *conn, ? ((priv->icon[STATUS_NOTIFIER_ICON].icon_name) ? priv->icon[STATUS_NOTIFIER_ICON].icon_name : "") : ""); else if (!g_strcmp0 (property, "IconPixmap")) - return g_variant_new ("a(iiay)", - get_builder_for_icon_pixmap (sn, STATUS_NOTIFIER_ICON)); + return get_icon_pixmap (sn, STATUS_NOTIFIER_ICON); else if (!g_strcmp0 (property, "OverlayIconName")) return g_variant_new ("s", (!priv->icon[STATUS_NOTIFIER_OVERLAY_ICON].has_pixbuf) ? ((priv->icon[STATUS_NOTIFIER_OVERLAY_ICON].icon_name) ? priv->icon[STATUS_NOTIFIER_OVERLAY_ICON].icon_name : "") : ""); else if (!g_strcmp0 (property, "OverlayIconPixmap")) - return g_variant_new ("a(iiay)", - get_builder_for_icon_pixmap (sn, STATUS_NOTIFIER_OVERLAY_ICON)); + return get_icon_pixmap (sn, STATUS_NOTIFIER_OVERLAY_ICON); else if (!g_strcmp0 (property, "AttentionIconName")) return g_variant_new ("s", (!priv->icon[STATUS_NOTIFIER_ATTENTION_ICON].has_pixbuf) ? ((priv->icon[STATUS_NOTIFIER_ATTENTION_ICON].icon_name) ? priv->icon[STATUS_NOTIFIER_ATTENTION_ICON].icon_name : "") : ""); else if (!g_strcmp0 (property, "AttentionIconPixmap")) - return g_variant_new ("a(iiay)", - get_builder_for_icon_pixmap (sn, STATUS_NOTIFIER_ATTENTION_ICON)); + return get_icon_pixmap (sn, STATUS_NOTIFIER_ATTENTION_ICON); else if (!g_strcmp0 (property, "AttentionMovieName")) return g_variant_new ("s", (priv->attention_movie_name) ? priv->attention_movie_name : ""); @@ -1620,7 +1621,7 @@ get_prop (GDBusConnection *conn, return variant; } - builder = get_builder_for_icon_pixmap (sn, STATUS_NOTIFIER_TOOLTIP_ICON); + builder = get_icon_pixmap (sn, STATUS_NOTIFIER_TOOLTIP_ICON); variant = g_variant_new ("(sa(iiay)ss)", "", builder, diff --git a/src/widget/contentlayout.cpp b/src/widget/contentlayout.cpp index 9012897b7..150444e5b 100644 --- a/src/widget/contentlayout.cpp +++ b/src/widget/contentlayout.cpp @@ -73,12 +73,14 @@ void ContentLayout::clear() { item->widget()->hide(); item->widget()->setParent(nullptr); + delete item; } while ((item = mainContent->layout()->takeAt(0)) != 0) { item->widget()->hide(); item->widget()->setParent(nullptr); + delete item; } } diff --git a/src/widget/genericchatroomwidget.cpp b/src/widget/genericchatroomwidget.cpp index be25f919a..3382e2776 100644 --- a/src/widget/genericchatroomwidget.cpp +++ b/src/widget/genericchatroomwidget.cpp @@ -72,6 +72,7 @@ void GenericChatroomWidget::compactChange(bool _compact) // avatar if (isCompact()) { + delete textLayout; // Not needed setFixedHeight(25); avatar->setSize(QSize(20,20)); mainLayout->addSpacing(18); diff --git a/src/widget/systemtrayicon.cpp b/src/widget/systemtrayicon.cpp index f55a767eb..b066b2403 100644 --- a/src/widget/systemtrayicon.cpp +++ b/src/widget/systemtrayicon.cpp @@ -107,12 +107,12 @@ SystemTrayIcon::SystemTrayIcon() { delete reinterpret_cast(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); + 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);