diff options
author | dt <qtc-committer@nokia.com> | 2010-06-03 13:55:16 +0200 |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2010-06-07 12:43:07 +0200 |
commit | e3e71d4437e9d95cffb1ee1a5e8518add97c8c45 (patch) | |
tree | 6fb33c96dff6462966dadf976eec1e9615c68cb4 | |
parent | e2ae25f42dfe821c3091c5ae9232b8c05f9b1ac2 (diff) | |
download | qt-creator-e3e71d4437e9d95cffb1ee1a5e8518add97c8c45.tar.gz |
Fix crash on session restore
Do the project restore for each project directly after opening and only
then processEvents(). A project might be in a intermediate state between
opening and restoring.
(cherry picked from commit 4ad02938c89f8df09bdae3e566cd62cb3bf17f08)
-rw-r--r-- | src/plugins/projectexplorer/projectexplorer.cpp | 53 |
1 files changed, 18 insertions, 35 deletions
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index bf5ee33860..893ddd4120 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1014,54 +1014,37 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); QList<IProjectManager*> projectManagers = pm->getObjects<IProjectManager>(); - //QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - // bool blocked = blockSignals(true); QList<Project*> openedPro; foreach (const QString &fileName, fileNames) { if (const Core::MimeType mt = Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName))) { - foreach (IProjectManager *manager, projectManagers) + foreach (IProjectManager *manager, projectManagers) { if (manager->mimeType() == mt.type()) { - if (Project *pro = manager->openProject(fileName)) - openedPro += pro; + if (Project *pro = manager->openProject(fileName)) { + if (pro->restoreSettings()) { + connect(pro, SIGNAL(fileListChanged()), this, SIGNAL(fileListChanged())); + d->m_session->addProject(pro); + // Make sure we always have a current project / node + if (!d->m_currentProject && !openedPro.isEmpty()) + setCurrentNode(pro->rootProjectNode()); + openedPro += pro; + } else { + delete pro; + } + } d->m_session->reportProjectLoadingProgress(); break; } + } } } - //blockSignals(blocked); + updateActions(); if (openedPro.isEmpty()) { - if (debug) - qDebug() << "ProjectExplorerPlugin - Could not open any projects!"; - QApplication::restoreOverrideCursor(); - return QList<Project *>(); - } - - QList<Project *>::iterator it, end; - end = openedPro.end(); - for (it = openedPro.begin(); it != end; ) { - if (debug) - qDebug()<<"restoring settings for "<<(*it)->file()->fileName(); - if ((*it)->restoreSettings()) { - connect(*it, SIGNAL(fileListChanged()), this, SIGNAL(fileListChanged())); - ++it; - } else { - delete *it; - it = openedPro.erase(it); - } + qDebug() << "ProjectExplorerPlugin - Could not open any projects!"; + } else { + Core::ModeManager::instance()->activateMode(Core::Constants::MODE_EDIT); } - d->m_session->addProjects(openedPro); - - // Make sure we always have a current project / node - if (!d->m_currentProject && !openedPro.isEmpty()) - setCurrentNode(openedPro.first()->rootProjectNode()); - - updateActions(); - - Core::ModeManager::instance()->activateMode(Core::Constants::MODE_EDIT); - QApplication::restoreOverrideCursor(); - return openedPro; } |