forked from qt-creator/qt-creator
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:
@@ -85,6 +85,8 @@ DebuggerMainWindow::DebuggerMainWindow()
|
|||||||
|
|
||||||
DebuggerMainWindow::~DebuggerMainWindow()
|
DebuggerMainWindow::~DebuggerMainWindow()
|
||||||
{
|
{
|
||||||
|
savePerspectiveHelper(m_currentPerspectiveId);
|
||||||
|
|
||||||
delete m_editorPlaceHolder;
|
delete m_editorPlaceHolder;
|
||||||
m_editorPlaceHolder = nullptr;
|
m_editorPlaceHolder = nullptr;
|
||||||
// As we have to setParent(0) on dock widget that are not selected,
|
// 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)));
|
ICore::addAdditionalContext(Context(Id::fromName(m_currentPerspectiveId)));
|
||||||
|
|
||||||
QTC_ASSERT(m_perspectiveForPerspectiveId.contains(m_currentPerspectiveId), return);
|
|
||||||
const Perspective *perspective = m_perspectiveForPerspectiveId.value(m_currentPerspectiveId);
|
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();
|
perspective->aboutToActivate();
|
||||||
for (const Perspective::Operation &operation : perspective->operations()) {
|
for (const Perspective::Operation &operation : perspective->operations()) {
|
||||||
QDockWidget *dock = m_dockForDockId.value(operation.dockId);
|
QDockWidget *dock = m_dockForDockId.value(operation.dockId);
|
||||||
|
Reference in New Issue
Block a user