From eaa30e06ea78fcf9c555c62ab274a86a056c69a0 Mon Sep 17 00:00:00 2001 From: Flavio Tordini Date: Sun, 30 Aug 2015 12:07:28 +0200 Subject: [PATCH] history stack as non-pointer member --- src/mainwindow.cpp | 13 ++++--------- src/mainwindow.h | 3 +-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6eb56c9..feb1a7a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -105,7 +105,6 @@ MainWindow::MainWindow() : #endif // views mechanism - history = new QStack(); views = new QStackedWidget(); views->hide(); setCentralWidget(views); @@ -165,10 +164,6 @@ MainWindow::MainWindow() : QTimer::singleShot(0, this, SLOT(lazyInit())); } -MainWindow::~MainWindow() { - delete history; -} - void MainWindow::lazyInit() { #ifdef APP_PHONON initPhonon(); @@ -947,9 +942,9 @@ void MainWindow::writeSettings() { } void MainWindow::goBack() { - if ( history->size() > 1 ) { - history->pop(); - QWidget *widget = history->pop(); + if (history.size() > 1) { + history.pop(); + QWidget *widget = history.pop(); showWidget(widget); } } @@ -1012,7 +1007,7 @@ void MainWindow::showWidget(QWidget* widget, bool transition) { */ } - history->push(widget); + history.push(widget); } void MainWindow::about() { diff --git a/src/mainwindow.h b/src/mainwindow.h index 6cccabd..060a8c3 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -48,7 +48,6 @@ class MainWindow : public QMainWindow { public: static MainWindow* instance(); MainWindow(); - ~MainWindow(); #ifdef APP_PHONON_SEEK Phonon::SeekSlider* getSeekSlider() { return seekSlider; } #else @@ -173,7 +172,7 @@ private: // view mechanism QStackedWidget *views; - QStack *history; + QStack history; QList viewActions; // view widgets -- 2.39.5