With styles that want the selected combobox item to flash, QComboBox
runs a modal event loop in hidePopup. This might result in reentrancy if
a mouseReleaseEvent is processed during the 60 ms of flashing.
Since mouseReleaseEvent calls hidePopup again, we end up reentrancy and
possibly undefined behavior which has caused crashes with Qt Creator on
macOS.
Prevent the reentrancy of hidePopup using a boolean flag. Since
QBoolBlocker (or QScopedValueRollback) cannot be used with a bit flag,
use a QScopeGuard to reset the flag reliably.
Fixes: QTBUG-105951
Change-Id: Iaa5df47b93217fc8dff621764ac4005bbc3459b7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
(cherry picked from commit 2af64c4577e42fecfeab9611c15fa8526bb09988)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>