KitAspectWidget: Use Utils::Guard in subclasses

Change-Id: I5bffdb1139151a87fcad48d255729da54d33de51
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-07-22 11:19:45 +02:00
parent 30b815700e
commit f516770281
2 changed files with 15 additions and 14 deletions

View File

@@ -52,6 +52,7 @@
#include <utils/commandline.h>
#include <utils/elidinglabel.h>
#include <utils/environment.h>
#include <utils/guard.h>
#include <utils/layoutbuilder.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
@@ -190,10 +191,11 @@ private:
const int pos = indexOf(id);
QTC_ASSERT(pos >= 0, return);
// do not handle the current index changed signal
m_removingItem = true;
m_comboBox->removeItem(pos);
m_removingItem = false;
{
// do not handle the current index changed signal
const GuardLocker locker(m_ignoreChanges);
m_comboBox->removeItem(pos);
}
// update the checkbox and set the current index
updateComboBox();
@@ -202,14 +204,14 @@ private:
void currentCMakeToolChanged(int index)
{
if (m_removingItem)
if (m_ignoreChanges.isLocked())
return;
const Id id = Id::fromSetting(m_comboBox->itemData(index));
CMakeKitAspect::setCMakeTool(m_kit, id);
}
bool m_removingItem = false;
Guard m_ignoreChanges;
QComboBox *m_comboBox;
QWidget *m_manageButton;
};