summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2023-03-10 16:40:20 +0100
committerIvan Solovev <ivan.solovev@qt.io>2023-03-13 19:24:14 +0100
commit0ac234f9e256949cbacb77f94d39fff90caba7b4 (patch)
tree6e84f7a6fa388360fbc9fa96205df5d6badaca19 /examples
parent441993a9a2e6cb236667ff67e06f1673df06db0a (diff)
Imagescaling example: fix memory leaks
* The DownloadDialog was never destroyed properly. Pass 'this' to its constructor to fix it. * When re-creating an image grid layout, properly clean up old image labels in Images::initLayout() Task-number: QTBUG-103514 Pick-to: 6.5 6.5.0 Change-Id: Ief52774002632d4ad3a6cca85bb0c0aa1a1d4bc0 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/qtconcurrent/imagescaling/imagescaling.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/qtconcurrent/imagescaling/imagescaling.cpp b/examples/qtconcurrent/imagescaling/imagescaling.cpp
index 79616a1353..d674ddd085 100644
--- a/examples/qtconcurrent/imagescaling/imagescaling.cpp
+++ b/examples/qtconcurrent/imagescaling/imagescaling.cpp
@@ -8,7 +8,7 @@
#include <functional>
-Images::Images(QWidget *parent) : QWidget(parent), downloadDialog(new DownloadDialog())
+Images::Images(QWidget *parent) : QWidget(parent), downloadDialog(new DownloadDialog(this))
{
resize(800, 600);
@@ -189,6 +189,7 @@ void Images::initLayout(qsizetype count)
QLayoutItem *child;
while ((child = imagesLayout->takeAt(0)) != nullptr) {
child->widget()->setParent(nullptr);
+ delete child->widget();
delete child;
}
labels.clear();