From 3891ed97052966e35b6e8af895e8abd7a0a79afd Mon Sep 17 00:00:00 2001 From: con Date: Mon, 25 Oct 2010 13:37:46 +0200 Subject: [PATCH] Don't close modified files or the current file at end of debug session Acked-by: hjk --- src/plugins/debugger/debuggeragents.cpp | 5 +++-- src/plugins/debugger/debuggerconstants.h | 3 +++ src/plugins/debugger/debuggerplugin.cpp | 16 ++++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/plugins/debugger/debuggeragents.cpp b/src/plugins/debugger/debuggeragents.cpp index c4b592856a..d18e72c2aa 100644 --- a/src/plugins/debugger/debuggeragents.cpp +++ b/src/plugins/debugger/debuggeragents.cpp @@ -33,6 +33,7 @@ #include "debuggerplugin.h" #include "debuggerstringutils.h" #include "stackframe.h" +#include "debuggerconstants.h" #include #include @@ -367,8 +368,8 @@ void DisassemblerViewAgent::setContents(const QString &contents) Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, &titlePattern)); QTC_ASSERT(d->editor, return); - d->editor->setProperty("OpenedByDebugger", true); - d->editor->setProperty("DisassemblerView", true); + d->editor->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, true); + d->editor->setProperty(Debugger::Constants::OPENED_WITH_DISASSEMBLY, true); d->configureMimeType(); } diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h index 0360144147..a01e327592 100644 --- a/src/plugins/debugger/debuggerconstants.h +++ b/src/plugins/debugger/debuggerconstants.h @@ -87,6 +87,9 @@ namespace Internal { } // namespace Internal +const char * const OPENED_BY_DEBUGGER = "OpenedByDebugger"; +const char * const OPENED_WITH_DISASSEMBLY = "DisassemblerView"; + } // namespace Constants diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index ea90ff9f15..c178d8a2ae 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2146,9 +2146,17 @@ void DebuggerPluginPrivate::cleanupViews() if (theDebuggerBoolSetting(CloseBuffersOnExit)) { if (EditorManager *editorManager = EditorManager::instance()) { QList toClose; - foreach (IEditor *editor, editorManager->openedEditors()) - if (editor->property("OpenedByDebugger").toBool()) - toClose.append(editor); + foreach (IEditor *editor, editorManager->openedEditors()) { + if (editor->property(Debugger::Constants::OPENED_BY_DEBUGGER).toBool()) { + // close disassembly views. close other opened files if they are not modified and not current editor + if (editor->property(Debugger::Constants::OPENED_WITH_DISASSEMBLY).toBool() + || (!editor->file()->isModified() && editor != editorManager->currentEditor())) { + toClose.append(editor); + } else { + editor->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, false); + } + } + } editorManager->closeEditors(toClose); } } @@ -2425,7 +2433,7 @@ void DebuggerPluginPrivate::gotoLocation(const QString &file, int line, bool set if (!editor) return; if (newEditor) - editor->setProperty("OpenedByDebugger", true); + editor->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, true); if (setMarker) m_locationMark.reset(new LocationMark(file, line)); } -- 2.11.0