diff options
author | Andrey Bienkowski <mongoose11235813@gmail.com> | 2015-11-09 08:21:12 +0300 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-11-19 11:30:50 +0000 |
commit | a7db6e34670b946c38e46ed28d8146c271c6c130 (patch) | |
tree | 636820834305ca0ec3d045f03284d0d76df354af /examples | |
parent | bbe65832f57709ac14bccfe0d5d06723f1397d1d (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')
-rw-r--r-- | examples/widgets/graphicsview/chip/mainwindow.cpp | 2 | ||||
-rw-r--r-- | examples/widgets/graphicsview/chip/view.cpp | 2 |
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); |