From 59912568d01033992aca53a0d91834c65a7349ca Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 2 Apr 2014 12:56:14 -0700 Subject: Only create UpdateManager once it is needed Instead of unconditionally creating the object at program start let's create it the first time we need it. That should avoid adding more and more delays at program start (not to mention the usually unnecessary memory use). Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index ead32835c..e86f22392 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -54,7 +54,8 @@ MainWindow::MainWindow() : QMainWindow(), helpView(0), yearlyStats(0), yearlyStatsModel(0), - state(VIEWALL) + state(VIEWALL), + updateManager(0) { Q_ASSERT_X(m_Instance == NULL, "MainWindow", "MainWindow recreated!"); m_Instance = this; @@ -85,7 +86,6 @@ MainWindow::MainWindow() : QMainWindow(), ui.divePlanner->settingsChanged(); ui.divePlannerWidget->settingsChanged(); - updateManager = new UpdateManager(this); #ifndef ENABLE_PLANNER // ui.menuLog->removeAction(ui.actionDivePlanner); @@ -580,6 +580,9 @@ void MainWindow::on_actionAboutSubsurface_triggered() void MainWindow::on_action_Check_for_Updates_triggered() { + if (!updateManager) + updateManager = new UpdateManager(this); + updateManager->checkForUpdates(); } -- cgit v1.2.3-70-g09d2