Debugger: Delete breakpoint markers on session switch

There were some left-over "ghost markers" when switching sessions,
which should be gone now.

This also pointed to a wrong use of SessionManager::aboutToUnloadSession
which mustn't save data re-created in a save/load cycle as it
is called during any session load, including the very first on startup
no such data (e.g. breakpoints) have been created yet.

Change-Id: I237a9e3500a786841618941ce85a97f7bd4f318c
Fixes: QTCREATORBUG-22856
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-11-22 16:55:53 +01:00
parent 6b1d54421e
commit 70aab593bd
2 changed files with 4 additions and 10 deletions

View File

@@ -2114,7 +2114,10 @@ GlobalBreakpointItem::GlobalBreakpointItem()
}
GlobalBreakpointItem::~GlobalBreakpointItem()
{}
{
delete m_marker;
m_marker = nullptr;
}
QVariant GlobalBreakpointItem::data(int column, int role) const
{
@@ -2414,8 +2417,6 @@ BreakpointManager::BreakpointManager()
this, &BreakpointManager::loadSessionData);
connect(SessionManager::instance(), &SessionManager::aboutToSaveSession,
this, &BreakpointManager::saveSessionData);
connect(SessionManager::instance(), &SessionManager::aboutToUnloadSession,
this, &BreakpointManager::aboutToUnloadSession);
}
QAbstractItemModel *BreakpointManager::model()
@@ -2797,12 +2798,6 @@ void BreakpointManager::saveSessionData()
SessionManager::setValue("Breakpoints", list);
}
void BreakpointManager::aboutToUnloadSession()
{
saveSessionData();
clear();
}
void BreakpointManager::loadSessionData()
{
clear();