qt6-bb10/tests/auto/widgets/dialogs
Christian Heimlich 10bc093d4f Add reentrancy guard for processEvents() in QProgressDialog::setValue()
Current implementation of QProgressDialog always calls
QCoreApplication::processEvents() when the user calls
QProgressDialog::setValue() if the PD is modal. For most cases this is
fine, but when using a Qt::WindowModal PD with setValue() connected to
a signal in another thread using Qt::QueuedConnection a reentrancy
issue is present if setValue() is triggered too frequently as the
execution of its previous call may not have finished. If this happens
too many times in a row a stack overflow will occur.

Current documentation notes this potential issue but offers no way it
avoid it while still using QProgressDialog (user must implement a
custom dialog) without resorting to using Qt::BlockingQueuedConnection,
which unnecessarily reduces performance.

Introduces the boolean reentrancy guard "processingEvents" that is
checked before calling QCoreApplication::processEvents() in a modal
PD when setValue() is used. It is set before the first call to
processEvents() and cleared after that call returns. This ensures that
only one invocation of processEvents() is possible from within
setValue() at a time, and thereby minimizes iterations of the main event
loop and eliminates the aforementioned stack overflow condition.

See - https://forum.qt.io/topic/118292/

Fixes: QTBUG-10561
Pick-to: 5.15
Change-Id: Ifa9b91cbb66881981356954ead0906bdc91fab60
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-09-21 03:19:55 -04:00
..
qcolordialog CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qdialog Remove most compiler warnings about missing overrides 2020-09-11 00:20:47 +02:00
qerrormessage CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qfiledialog Remove most compiler warnings about missing overrides 2020-09-11 00:20:47 +02:00
qfiledialog2 Remove most compiler warnings about missing overrides 2020-09-11 00:20:47 +02:00
qfontdialog Make QFontDatabase member functions static 2020-08-06 11:43:24 +02:00
qinputdialog Remove most compiler warnings about missing overrides 2020-09-11 00:20:47 +02:00
qmessagebox Remove most compiler warnings about missing overrides 2020-09-11 00:20:47 +02:00
qprogressdialog Add reentrancy guard for processEvents() in QProgressDialog::setValue() 2020-09-21 03:19:55 -04:00
qsidebar Move QFileSystemModel into QtGui 2020-08-25 06:33:44 +02:00
qwizard Remove most compiler warnings about missing overrides 2020-09-11 00:20:47 +02:00
CMakeLists.txt Move QFileSystemModel into QtGui 2020-08-25 06:33:44 +02:00
dialogs.pro Move QFileSystemModel into QtGui 2020-08-25 06:33:44 +02:00