aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-04-02 12:56:14 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-04-02 12:56:14 -0700
commit59912568d01033992aca53a0d91834c65a7349ca (patch)
tree69513da88bc05d3dab77b733cca41b41a58c5129
parent4ee94167f167fd9dcce1331c1d69ef8e36174ad7 (diff)
downloadsubsurface-59912568d01033992aca53a0d91834c65a7349ca.tar.gz
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 <dirk@hohndel.org>
-rw-r--r--qt-ui/mainwindow.cpp7
1 files changed, 5 insertions, 2 deletions
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();
}