Bound the scope of QTRY_LOOP_IMPL()'s local variable
QTRY_IMPL() exercises QTRY_LOOP_IMPL() twice, once directly, the
second time via QTRY_TIMEOUT_DEBUG_IMPL(); and QTRY_LOOP_IMPL()
deliberately doesn't bound its scope (e.g. with the canonical
do{...}while(0) trick) so that the latter can access its local
variable. Unfortunately, this means the local's declaration in the
second use of QTRY_LOOP_IMPL() shadows the first. So enclose the first
in braces to bound the scope.
Fixes: QTBUG-77297
Change-Id: I849bfe0b8abfb517ed3e783abf86c602163db137
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
bb10
parent
7f4f346e51
commit
0b984e141b
|
|
@ -152,7 +152,7 @@ do {\
|
|||
#define QTRY_IMPL(expr, timeout)\
|
||||
const int qt_test_step = timeout < 350 ? timeout / 7 + 1 : 50; \
|
||||
const int qt_test_timeoutValue = timeout; \
|
||||
QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); \
|
||||
{ QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); } \
|
||||
QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)\
|
||||
|
||||
// Will try to wait for the expression to become true while allowing event processing
|
||||
|
|
|
|||
Loading…
Reference in New Issue