summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorAndrey Bienkowski <mongoose11235813@gmail.com>2015-11-09 08:21:12 +0300
committerMarc Mutz <marc.mutz@kdab.com>2015-11-19 11:30:50 +0000
commita7db6e34670b946c38e46ed28d8146c271c6c130 (patch)
tree636820834305ca0ec3d045f03284d0d76df354af /examples/widgets
parentbbe65832f57709ac14bccfe0d5d06723f1397d1d (diff)
Fixed memory leaks in the "40000 chips" example.
Two QObjects had no parent. This caused memory leaks on app close. Confirmed with the valgrind memory analyzer tool from Qt Creator. Change-Id: I9294099ca819be1a9c5b74b3cec5bf197be06433 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/graphicsview/chip/mainwindow.cpp2
-rw-r--r--examples/widgets/graphicsview/chip/view.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/examples/widgets/graphicsview/chip/mainwindow.cpp b/examples/widgets/graphicsview/chip/mainwindow.cpp
index f88c358513..85d1c1c1fe 100644
--- a/examples/widgets/graphicsview/chip/mainwindow.cpp
+++ b/examples/widgets/graphicsview/chip/mainwindow.cpp
@@ -76,7 +76,7 @@ MainWindow::MainWindow(QWidget *parent)
void MainWindow::populateScene()
{
- scene = new QGraphicsScene;
+ scene = new QGraphicsScene(this);
QImage image(":/qt4logo.png");
diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp
index 0a4179b364..8c1fc79f5b 100644
--- a/examples/widgets/graphicsview/chip/view.cpp
+++ b/examples/widgets/graphicsview/chip/view.cpp
@@ -147,7 +147,7 @@ View::View(const QString &name, QWidget *parent)
printButton = new QToolButton;
printButton->setIcon(QIcon(QPixmap(":/fileprint.png")));
- QButtonGroup *pointerModeGroup = new QButtonGroup;
+ QButtonGroup *pointerModeGroup = new QButtonGroup(this);
pointerModeGroup->setExclusive(true);
pointerModeGroup->addButton(selectModeButton);
pointerModeGroup->addButton(dragModeButton);