From 0522acca7605709096b11cc8e91d7fb69eca88b6 Mon Sep 17 00:00:00 2001 From: Lawrence Thorpe Date: Thu, 2 Nov 2017 12:49:39 +0000 Subject: [PATCH] Fix: delete scene --- src/mainwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ecc60ff..8ccc0e4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -9,6 +9,7 @@ MainWindow::MainWindow(QWidget *parent) : QIcon::setThemeName("oxygen"); #endif ui->setupUi(this); + scene = nullptr; ui->actionUndo->setEnabled(false); } @@ -40,7 +41,8 @@ void MainWindow::updateProgress(int progress) { void MainWindow::showImage(QImage image) { this->image = image; - //delete scene; + if (scene) + delete scene; scene = new QGraphicsScene(ui->graphicsView); scene->addPixmap(QPixmap::fromImage(image)); ui->graphicsView->setScene(scene);