Meson: Fix crash after adding first meson/ninja tools

- start Qt Creator without any meson or ninja tools registered
  (also not auto-detected)
- add meson and ninja in the settings and apply
- open kit settings and select a kit

This would crash, because the constructor of the meson
ToolKitAspectWidget saw that there was no tool registered and triggered
setting the default tool. Doing that in the widget constructor results
in an endless loop because changing the tool triggers an update of the
kit which triggers an update of the ToolKitAspectWidget which doesn't
exist yet (because the constructor didn't finish yet), so it would be
created again which results in the same situation and endless recursion.

Do not change the selected value in the widget constructor. This is the
same logic as for the CMakeKitAspect(Impl).

Fixes: QTCREATORBUG-30698
Change-Id: I35d56018d8f02a2716dfac763fa86d4426393172
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2024-05-30 14:40:07 +02:00
parent f00394b371
commit 81aed65406

View File

@@ -49,11 +49,7 @@ private:
return MesonToolKitAspect::mesonToolId(m_kit); return MesonToolKitAspect::mesonToolId(m_kit);
return NinjaToolKitAspect::ninjaToolId(m_kit); return NinjaToolKitAspect::ninjaToolId(m_kit);
}(); }();
if (id.isValid()) m_toolsComboBox->setCurrentIndex(indexOf(id));
m_toolsComboBox->setCurrentIndex(indexOf(id));
else {
setToDefault();
}
} }
QComboBox *m_toolsComboBox; QComboBox *m_toolsComboBox;