From 8247a0b4d78698e3c2da747b54b1254ca4f1fdc2 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Thu, 23 Apr 2015 11:06:14 +0200 Subject: [PATCH] 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 --- src/plugins/projectexplorer/session.cpp | 2 +- src/plugins/projectexplorer/session.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 74fcd85a09e..889ede52a7a 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -433,7 +433,7 @@ void SessionManager::closeAllProjects() removeProjects(projects()); } -const QList &SessionManager::projects() +QList SessionManager::projects() { return d->m_projects; } diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h index 9f59f8c622b..06600557ed9 100644 --- a/src/plugins/projectexplorer/session.h +++ b/src/plugins/projectexplorer/session.h @@ -101,7 +101,7 @@ public: static Utils::FileName sessionNameToFileName(const QString &session); static Project *startupProject(); - static const QList &projects(); + static QList projects(); static bool hasProjects(); static bool isDefaultVirgin();