diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp index ed771668b33..83329ef46c4 100644 --- a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp +++ b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp @@ -402,11 +402,27 @@ void MenuActionContainer::removeMenu(QMenu *menu) m_menu->removeAction(menu->menuAction()); } +static bool menuInMenuBar(const QMenu *menu) +{ + foreach (const QWidget *widget, menu->menuAction()->associatedWidgets()) { + if (qobject_cast(widget)) + return true; + } + return false; +} + bool MenuActionContainer::updateInternal() { if (onAllDisabledBehavior() == Show) return true; +#ifdef Q_OS_MAC + // work around QTBUG-25544 which makes menus in the menu bar stay at their enabled state at startup + // (so menus that are disabled at startup would stay disabled) + if (menuInMenuBar(m_menu)) + return true; +#endif + bool hasitems = false; QList actions = m_menu->actions(); diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index c4123834e7c..be9028903a8 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -234,6 +234,13 @@ MainWindow::MainWindow() : #if defined(Q_OS_MAC) MacFullScreen::addFullScreen(this); #endif + + 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) @@ -389,6 +396,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 96a50729bfe..20be8cf83c9 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -236,6 +236,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 65c9f592924..461726e51c0 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -244,6 +244,7 @@ struct ProjectExplorerPluginPrivate { Core::IMode *m_projectsMode; TaskHub *m_taskHub; + bool m_shuttingDown; }; ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() : @@ -251,7 +252,8 @@ ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() : m_currentNode(0), m_delayedRunConfiguration(0), m_runMode(NoRunMode), - m_projectsMode(0) + m_projectsMode(0), + m_shuttingDown(false) { } @@ -1169,6 +1171,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). @@ -1240,6 +1243,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 4e47a8c298d..87127403fd3 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() @@ -902,7 +896,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 972a6496591..d238080bde9 100644 --- a/src/plugins/projectexplorer/session.h +++ b/src/plugins/projectexplorer/session.h @@ -169,7 +169,6 @@ private: mutable QStringList m_sessions; mutable QHash m_projectFileCache; - QTimer *m_autoSaveSessionTimer; Project *m_startupProject; QList m_projects;