DebuggerKitAspectWidget: Use Utils::Guard

Change-Id: I42407c110971f97599295f5d2be7652e512d3c72
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-07-22 10:35:11 +02:00
parent 249d8585c4
commit e9a0d06867

View File

@@ -35,6 +35,7 @@
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/guard.h>
#include <utils/filepath.h> #include <utils/filepath.h>
#include <utils/layoutbuilder.h> #include <utils/layoutbuilder.h>
#include <utils/macroexpander.h> #include <utils/macroexpander.h>
@@ -96,7 +97,7 @@ private:
void refresh() override void refresh() override
{ {
m_ignoreChanges = true; const GuardLocker locker(m_ignoreChanges);
m_comboBox->clear(); m_comboBox->clear();
m_comboBox->addItem(Tr::tr("None"), QString()); m_comboBox->addItem(Tr::tr("None"), QString());
for (const DebuggerItem &item : DebuggerItemManager::debuggers()) for (const DebuggerItem &item : DebuggerItemManager::debuggers())
@@ -104,13 +105,12 @@ private:
const DebuggerItem *item = DebuggerKitAspect::debugger(m_kit); const DebuggerItem *item = DebuggerKitAspect::debugger(m_kit);
updateComboBox(item ? item->id() : QVariant()); updateComboBox(item ? item->id() : QVariant());
m_ignoreChanges = false;
} }
void currentDebuggerChanged(int idx) void currentDebuggerChanged(int idx)
{ {
Q_UNUSED(idx) Q_UNUSED(idx)
if (m_ignoreChanges) if (m_ignoreChanges.isLocked())
return; return;
int currentIndex = m_comboBox->currentIndex(); int currentIndex = m_comboBox->currentIndex();
@@ -131,7 +131,7 @@ private:
m_comboBox->setCurrentIndex(0); m_comboBox->setCurrentIndex(0);
} }
bool m_ignoreChanges = false; Guard m_ignoreChanges;
QComboBox *m_comboBox; QComboBox *m_comboBox;
QWidget *m_manageButton; QWidget *m_manageButton;
}; };