Debugger: Avoid duplication of SDK debuggers

Task-number: QTCREATORBUG-12888
Change-Id: I732f1bfe44dc47d0c96570649f3bf8c0e3f40dda
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2014-08-24 08:36:07 +03:00
committed by Orgad Shaneh
parent 72c60097c3
commit 5b5a7d1dea

View File

@@ -378,18 +378,15 @@ void DebuggerItemManager::saveDebuggers()
QVariant DebuggerItemManager::registerDebugger(const DebuggerItem &item) QVariant DebuggerItemManager::registerDebugger(const DebuggerItem &item)
{ {
// Force addition when Id is set. // Try re-using existing item first.
if (item.id().isValid())
return addDebugger(item);
// Otherwise, try re-using existing item first.
foreach (const DebuggerItem &d, m_debuggers) { foreach (const DebuggerItem &d, m_debuggers) {
if (d.command() == item.command() if (d.command() == item.command()
&& d.isAutoDetected() == item.isAutoDetected() && d.isAutoDetected() == item.isAutoDetected()
&& d.engineType() == item.engineType() && d.engineType() == item.engineType()
&& d.displayName() == item.displayName() && d.displayName() == item.displayName()
&& d.abis() == item.abis()) && d.abis() == item.abis()) {
return d.id(); return d.id();
}
} }
// Nothing suitable. Create a new id and add the item. // Nothing suitable. Create a new id and add the item.