SessionManager::projects() return a copy instead of a const&

Fixes a crash on session restore for Eike. Iterating over
a const & of the list is dangerous while projects are
added to the list.

Change-Id: I1861b7f1875420769c2493fb0b4012728380efd2
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Daniel Teske
2015-04-23 11:06:14 +02:00
parent 8be26d070e
commit 8247a0b4d7
2 changed files with 2 additions and 2 deletions

View File

@@ -433,7 +433,7 @@ void SessionManager::closeAllProjects()
removeProjects(projects()); removeProjects(projects());
} }
const QList<Project *> &SessionManager::projects() QList<Project *> SessionManager::projects()
{ {
return d->m_projects; return d->m_projects;
} }

View File

@@ -101,7 +101,7 @@ public:
static Utils::FileName sessionNameToFileName(const QString &session); static Utils::FileName sessionNameToFileName(const QString &session);
static Project *startupProject(); static Project *startupProject();
static const QList<Project *> &projects(); static QList<Project *> projects();
static bool hasProjects(); static bool hasProjects();
static bool isDefaultVirgin(); static bool isDefaultVirgin();