Commit f059018a authored by Daniel Teske's avatar Daniel Teske
Browse files

Stop the autosaving session timer on closing Creator



Change-Id: I3b9c791d95d7815a711f72cec08f405fb1cdac7c
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent 359b0a09
......@@ -227,6 +227,13 @@ MainWindow::MainWindow() :
statusBar()->setProperty("p_styled", true);
setAcceptDrops(true);
m_autoSaveSessionTimer = new QTimer(this);
m_autoSaveSessionTimer->setSingleShot(true);
m_autoSaveSessionTimer->setInterval(10000);
m_autoSaveSessionTimer->start();
connect(m_autoSaveSessionTimer, SIGNAL(timeout()),
m_coreImpl, SIGNAL(saveSettingsRequested()));
}
void MainWindow::setSidebarVisible(bool visible)
......@@ -372,6 +379,7 @@ void MainWindow::extensionsInitialized()
void MainWindow::closeEvent(QCloseEvent *event)
{
m_autoSaveSessionTimer->stop();
emit m_coreImpl->saveSettingsRequested();
// Save opened files
......
......@@ -232,6 +232,7 @@ private:
QColor m_overrideColor;
QStringList m_filesToOpenDelayed;
QTimer *m_autoSaveSessionTimer;
};
} // namespace Internal
......
......@@ -242,6 +242,7 @@ struct ProjectExplorerPluginPrivate {
Core::IMode *m_projectsMode;
TaskHub *m_taskHub;
bool m_shuttingDown;
};
ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
......@@ -249,7 +250,8 @@ ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
m_currentNode(0),
m_delayedRunConfiguration(0),
m_runMode(NoRunMode),
m_projectsMode(0)
m_projectsMode(0),
m_shuttingDown(false)
{
}
......@@ -1155,6 +1157,7 @@ ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown()
d->m_proWindow->aboutToShutdown(); // disconnect from session
d->m_session->closeAllProjects();
d->m_projectsMode = 0;
d->m_shuttingDown = true;
// Attempt to synchronously shutdown all run controls.
// If that fails, fall back to asynchronous shutdown (Debugger run controls
// might shutdown asynchronously).
......@@ -1226,6 +1229,9 @@ void ProjectExplorerPlugin::savePersistentSettings()
if (debug)
qDebug()<<"ProjectExplorerPlugin::savePersistentSettings()";
if (d->m_shuttingDown)
return;
foreach (Project *pro, d->m_session->projects())
pro->saveSettings();
......
......@@ -108,12 +108,6 @@ SessionManager::SessionManager(QObject *parent)
this, SLOT(markSessionFileDirty()));
connect(em, SIGNAL(editorsClosed(QList<Core::IEditor*>)),
this, SLOT(markSessionFileDirty()));
m_autoSaveSessionTimer = new QTimer(this);
m_autoSaveSessionTimer->setSingleShot(true);
m_autoSaveSessionTimer->setInterval(10000);
connect(m_autoSaveSessionTimer, SIGNAL(timeout()),
ICore::instance(), SIGNAL(saveSettingsRequested()));
}
SessionManager::~SessionManager()
......@@ -899,7 +893,6 @@ void SessionManager::reportProjectLoadingProgress()
void SessionManager::markSessionFileDirty(bool makeDefaultVirginDirty)
{
m_autoSaveSessionTimer->start();
if (makeDefaultVirginDirty)
m_virginSession = false;
}
......
......@@ -167,7 +167,6 @@ private:
mutable QStringList m_sessions;
mutable QHash<Project *, QStringList> m_projectFileCache;
QTimer *m_autoSaveSessionTimer;
Project *m_startupProject;
QList<Project *> m_projects;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment