summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-02-07 14:08:17 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2018-02-07 16:12:53 +0000
commit75c22d459872aca47ac2bb9e0e88d63f4f0b5d38 (patch)
tree72af6ab4eddb6adc09516457f5a27bbc48e746c4 /src/plugins/platforms/cocoa
parentea6675374fa6e94bd4cf10613c85cee2c724bcdc (diff)
QCocoaWindow: be more careful when flushing events
Flushing the QPA event queue is problematic since we can then end up delivering several events to Qt (or the app) at the same time on the call stack. This again can easily leave objects in an inconsistent state if they receive callbacks from subsequent events while being occupied processing the first. This is also what happens in the listed report. A QMenu shows a sub menu when the mouse enters a menu item. The show leads to QPA flushing events, which in some cases also includes flushing another pending move event. The move event is delivered to the same QMenu, which will clear a private variable (currentAction). When the show returns, the state of QMenu has unexpectedly changed, which causes a crash to happen since currentAction is null. This patch will fix the root cause of the problem by stopping QCocoaWindow from flushing user input events when the call location does a flush to deliver geometry events. Task-number: QTBUG-66093 Change-Id: Id277550b0a080ad98c81e8c30dc7098dc73723d5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index af2931c747..683834c1a0 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1131,7 +1131,7 @@ void QCocoaWindow::handleGeometryChange()
// Guard against processing window system events during QWindow::setGeometry
// calls, which Qt and Qt applications do not expect.
if (!m_inSetGeometry)
- QWindowSystemInterface::flushWindowSystemEvents();
+ QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers);
}
void QCocoaWindow::handleExposeEvent(const QRegion &region)