diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 4397688d7bd..f6996f92a48 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -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 diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 86d77f78000..de2097bb81b 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -232,6 +232,7 @@ private: QColor m_overrideColor; QStringList m_filesToOpenDelayed; + QTimer *m_autoSaveSessionTimer; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 146a682d48f..79171dfd072 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -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(); diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 1b5d5905118..dd5e376bc3c 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -108,12 +108,6 @@ SessionManager::SessionManager(QObject *parent) this, SLOT(markSessionFileDirty())); connect(em, SIGNAL(editorsClosed(QList)), 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; } diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h index d0c5b400612..c159920e45b 100644 --- a/src/plugins/projectexplorer/session.h +++ b/src/plugins/projectexplorer/session.h @@ -167,7 +167,6 @@ private: mutable QStringList m_sessions; mutable QHash m_projectFileCache; - QTimer *m_autoSaveSessionTimer; Project *m_startupProject; QList m_projects;