forked from qt-creator/qt-creator
Debugger: fix crash in kit setup
- bestItem went out of scope Change-Id: I947cb09951fe9f38e3c98cf168521a2cb39ecd0b Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -93,7 +93,7 @@ void DebuggerKitInformation::setup(Kit *k)
|
||||
// is stored in the kit information, but also accept item based
|
||||
// on toolchain matching as fallback with a lower priority.
|
||||
|
||||
const DebuggerItem *bestItem = 0;
|
||||
DebuggerItem bestItem;
|
||||
DebuggerItem::MatchLevel bestLevel = DebuggerItem::DoesNotMatch;
|
||||
|
||||
foreach (const DebuggerItem &item, DebuggerItemManager::debuggers()) {
|
||||
@@ -140,12 +140,12 @@ void DebuggerKitInformation::setup(Kit *k)
|
||||
|
||||
if (level > bestLevel) {
|
||||
bestLevel = level;
|
||||
bestItem = &item;
|
||||
bestItem = item;
|
||||
}
|
||||
}
|
||||
|
||||
// Use the best id we found, or an invalid one.
|
||||
k->setValue(DebuggerKitInformation::id(), bestItem ? bestItem->id() : QVariant());
|
||||
k->setValue(DebuggerKitInformation::id(), bestLevel != DebuggerItem::DoesNotMatch ? bestItem.id() : QVariant());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user