diff --git a/snapshot.cpp b/snapshot.cpp --- a/snapshot.cpp +++ b/snapshot.cpp @@ -15,6 +15,14 @@ SnapShot::SnapShot(QMainWindow* parent, connect(&_menuAction, &QAction::triggered, this, &SnapShot::show); } +SnapShot::~SnapShot() +{ + if (view != NULL) + { + delete view; + } +} + QAction* SnapShot::menuAction() { return &_menuAction; @@ -26,6 +34,7 @@ void SnapShot::show() { qDebug() << "view == NULL"; view = new SnapShotView(mainWindow, this); + connect(view, &SnapShotView::closed, this, &SnapShot::viewClosed); } view->show(); } @@ -34,3 +43,9 @@ void SnapShot::hide() { } + +void SnapShot::viewClosed() +{ + delete view; + view = NULL; +}