diff --git a/shared/cplusplus/Parser.cpp b/shared/cplusplus/Parser.cpp
index 46618dd112b8c653b33652ba41100a4109d31538..13fbaa0160b6185e3a9609085d10c13f708fa97c 100644
--- a/shared/cplusplus/Parser.cpp
+++ b/shared/cplusplus/Parser.cpp
@@ -1191,6 +1191,11 @@ bool Parser::parseClassSpecifier(SpecifierAST *&node)
     NameAST *name = 0;
     parseName(name);
 
+    bool parsed = false;
+
+    const bool previousInFunctionBody = _inFunctionBody;
+    _inFunctionBody = false;
+
     if (LA() == T_COLON || LA() == T_LBRACE) {
         BaseSpecifierAST *base_clause = 0;
         if (LA() == T_COLON) {
@@ -1233,9 +1238,12 @@ bool Parser::parseClassSpecifier(SpecifierAST *&node)
             }
         }
         node = ast;
-        return true;
+        parsed = true;
     }
-    return false;
+
+    _inFunctionBody = previousInFunctionBody;
+
+    return parsed;
 }
 
 bool Parser::parseAccessSpecifier(SpecifierAST *&node)
diff --git a/src/libs/cplusplus/TypeOfExpression.cpp b/src/libs/cplusplus/TypeOfExpression.cpp
index 2672bfb105f1422b8d39f3da2941d0ee280d2dfa..7dd669365fc3ec8bf3be89b6cf5e7c8ca8210759 100644
--- a/src/libs/cplusplus/TypeOfExpression.cpp
+++ b/src/libs/cplusplus/TypeOfExpression.cpp
@@ -91,7 +91,8 @@ Document::Ptr TypeOfExpression::documentForExpression(const QString &expression)
 {
     // create the expression's AST.
     Document::Ptr doc = Document::create(QLatin1String("<completion>"));
-    doc->setSource(expression.toUtf8());
+    const QByteArray bytes = expression.toUtf8();
+    doc->setSource(bytes);
     doc->parse(Document::ParseExpression);
     return doc;
 }
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index ddfe984a8d226d16ce8f44a7ad401dcda3a40a2c..29798b25c010e9202f09cd2c27d38e6278ff9900 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -74,20 +74,6 @@ using namespace Core::Internal;
 
 enum { debugEditorManager=0 };
 
-QString EditorManager::defaultExternalEditor() const
-{
-#ifdef Q_OS_MAC
-    return m_d->m_core->resourcePath()
-            +QLatin1String("/runInTerminal.command vi %f %l %c %W %H %x %y");
-#elif defined(Q_OS_UNIX)
-    return QLatin1String("xterm -geom %Wx%H+%x+%y -e vi %f +%l +\"normal %c|\"");
-#elif defined (Q_OS_WIN)
-    return QLatin1String("notepad %f");
-#else
-    return QString();
-#endif
-}
-
 //===================EditorManager=====================
 
 EditorManagerPlaceHolder *EditorManagerPlaceHolder::m_current = 0;
@@ -388,6 +374,20 @@ QSize EditorManager::minimumSizeHint() const
     return QSize(400, 300);
 }
 
+QString EditorManager::defaultExternalEditor() const
+{
+#ifdef Q_OS_MAC
+    return m_d->m_core->resourcePath()
+            +QLatin1String("/runInTerminal.command vi %f %l %c %W %H %x %y");
+#elif defined(Q_OS_UNIX)
+    return QLatin1String("xterm -geom %Wx%H+%x+%y -e vi %f +%l +\"normal %c|\"");
+#elif defined (Q_OS_WIN)
+    return QLatin1String("notepad %f");
+#else
+    return QString();
+#endif
+}
+
 EditorSplitter *EditorManager::editorSplitter() const
 {
     return m_d->m_splitter;
diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp
index df0eaa9f0b293d0379236ebc67172daf095aba40..e8f22f4944ad215833de75f3e36b7ccbed4f5274 100644
--- a/src/plugins/debugger/gdbengine.cpp
+++ b/src/plugins/debugger/gdbengine.cpp
@@ -444,7 +444,7 @@ void GdbEngine::handleResponse()
             break;
         }
 
-        if (token == -1 && *from != '&' && *from != '~') {
+        if (token == -1 && *from != '&' && *from != '~' && *from != '*') {
             // FIXME: On Linux the application's std::out is merged in here.
             // High risk of falsely interpreting this as MI output.
             // We assume that we _always_ use tokens, so not finding a token
@@ -493,8 +493,10 @@ void GdbEngine::handleResponse()
                 m_inbuffer = QByteArray(from, to - from);
                 if (asyncClass == "stopped") {
                     handleAsyncOutput(record);
+                } else if (asyncClass == "running") {
+                    // Archer has 'thread-id="all"' here
                 } else {
-                    qDebug() << "INGNORED ASYNC OUTPUT " << record.toString();
+                    qDebug() << "IGNORED ASYNC OUTPUT " << record.toString();
                 }
                 break;
             }
@@ -773,11 +775,6 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
     if (token == -1)
         return;
 
-    if (!m_cookieForToken.contains(token)) {
-        qDebug() << "NO SUCH TOKEN (ANYMORE): " << token;
-        return;
-    }
-
     GdbCookie cmd = m_cookieForToken.take(token);
 
     // FIXME: this falsely rejects results from the custom dumper recognition
@@ -788,12 +785,6 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
         return;
     }
 
-    // We get _two_ results for a '-exec-foo' command: First a
-    // 'running' notification, then a 'stopped' or similar.
-    // So put it back.
-    if (record.resultClass == GdbResultRunning)
-        m_cookieForToken[token] = cmd;
-
 #if 0
     qDebug() << "# handleOutput, "
         << "cmd type: " << cmd.type
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 9e41e3703f610f6fc65f82c921174dbf06f9a2f6..b95d5c19463d46a20a554fa4381b49ef178bf661 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -686,28 +686,19 @@ void ProjectExplorerPlugin::loadAction()
     updateActions();
 }
 
-bool ProjectExplorerPlugin::saveAction(Project *pro)
+void ProjectExplorerPlugin::unloadProject()
 {
     if (debug)
-        qDebug() << "ProjectExplorerPlugin::saveAction";
-
-    if (!pro)
-        pro = m_currentProject;
-    Q_ASSERT(pro);
-
-    Core::IFile *fi = pro->file();
+        qDebug() << "ProjectExplorerPlugin::unloadProject";
 
-    if (!fi) // TODO Why saving the session here????
-        fi = m_session->file();
+    Core::IFile *fi = m_currentProject->file();
 
     if (!fi || fi->fileName().isEmpty()) //nothing to save?
-        return false;
+        return;
 
     QList<Core::IFile*> filesToSave;
-
     filesToSave << fi;
-    if (pro)
-        filesToSave << pro->dependencies();
+    filesToSave << m_currentProject->dependencies();
 
     // check the number of modified files
     int readonlycount = 0;
@@ -722,20 +713,10 @@ bool ProjectExplorerPlugin::saveAction(Project *pro)
     else
         success = m_core->fileManager()->saveModifiedFilesSilently(filesToSave).isEmpty();
 
-    if (success)
-        addToRecentProjects(fi->fileName());
-    updateActions();
-    return success;
-}
-
-void ProjectExplorerPlugin::unloadProject()
-{
-    if (debug)
-        qDebug() << "ProjectExplorerPlugin::unloadProject";
-
-    if (!saveAction(m_currentProject))
+    if (!success)
         return;
 
+    addToRecentProjects(fi->fileName());
     m_session->removeProject(m_currentProject);
     updateActions();
 }
diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h
index 039def13052347ccb61ab58c3f14cca361224902..6a7f4beb83119b92c5756cd744430a9c720b2b9c 100644
--- a/src/plugins/projectexplorer/projectexplorer.h
+++ b/src/plugins/projectexplorer/projectexplorer.h
@@ -139,7 +139,6 @@ private slots:
     void cancelBuild();
     void debugProject();
     void editDependencies();
-    bool saveAction(ProjectExplorer::Project *pro = 0);
     void loadAction();
     void unloadProject();
     void clearSession();
diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp
index 61ca7df05a9a705c0cb84867e9810a44ba2d6ecf..876b8294a377c0ca72f49d88e2823ca8309acd2c 100644
--- a/src/plugins/projectexplorer/session.cpp
+++ b/src/plugins/projectexplorer/session.cpp
@@ -939,6 +939,7 @@ void SessionManager::removeProjects(QList<Project *> remove)
 
     // Delete projects
     foreach (Project *pro, remove) {
+        pro->saveSettings();
         m_file->m_projects.removeOne(pro);
 
         if (pro == m_file->m_startupProject)