Debugger: Make Perspective persistence more robust

Always save on exit, but do not expect a valid perspective name
on restart. The settings could get corrupted in the mean time etc.

Change-Id: Ic0181607f46c3350a4193240d795d4c0d7c6815b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
hjk
2018-07-24 15:40:35 +02:00
parent 99e3635ef3
commit 02a759d4f5

View File

@@ -85,6 +85,8 @@ DebuggerMainWindow::DebuggerMainWindow()
DebuggerMainWindow::~DebuggerMainWindow()
{
savePerspectiveHelper(m_currentPerspectiveId);
delete m_editorPlaceHolder;
m_editorPlaceHolder = nullptr;
// As we have to setParent(0) on dock widget that are not selected,
@@ -332,8 +334,12 @@ void DebuggerMainWindow::loadPerspectiveHelper(const QByteArray &perspectiveId,
ICore::addAdditionalContext(Context(Id::fromName(m_currentPerspectiveId)));
QTC_ASSERT(m_perspectiveForPerspectiveId.contains(m_currentPerspectiveId), return);
const Perspective *perspective = m_perspectiveForPerspectiveId.value(m_currentPerspectiveId);
if (!perspective) {
QTC_ASSERT(!m_perspectiveForPerspectiveId.isEmpty(), return);
perspective = *m_perspectiveForPerspectiveId.begin();
}
QTC_ASSERT(perspective, return);
perspective->aboutToActivate();
for (const Perspective::Operation &operation : perspective->operations()) {
QDockWidget *dock = m_dockForDockId.value(operation.dockId);