From fc049052812bfa0b63af1f3c5fcadf1eb582e775 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 19 Aug 2019 15:04:42 +0200 Subject: macOS: Bail out early in case a popup is closed by a mouseDown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It can happen that AppKit calls -mouseDown: on a popup's view, but we consider the click to be outside of popup's area (happens on the 1-pixel edge of a 'geometry', QRect::contains() returns false). If we send close event to essentially 'self', m_platformWindow is becoming nullptr. So we bail out early, no further processing is needed. Fixes: QTBUG-77348 Change-Id: I224943e6bcf4ae052412ef7dc7b23a94f999aa19 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qnsview_mouse.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qnsview_mouse.mm b/src/plugins/platforms/cocoa/qnsview_mouse.mm index a887cb841d..3a5a074264 100644 --- a/src/plugins/platforms/cocoa/qnsview_mouse.mm +++ b/src/plugins/platforms/cocoa/qnsview_mouse.mm @@ -389,14 +389,16 @@ } // Close the popups if the click was outside. if (!inside) { + bool selfClosed = false; Qt::WindowType type = QCocoaIntegration::instance()->activePopupWindow()->window()->type(); while (QCocoaWindow *popup = QCocoaIntegration::instance()->popPopupWindow()) { + selfClosed = self == popup->view(); QWindowSystemInterface::handleCloseEvent(popup->window()); QWindowSystemInterface::flushWindowSystemEvents(); } // Consume the mouse event when closing the popup, except for tool tips // were it's expected that the event is processed normally. - if (type != Qt::ToolTip) + if (type != Qt::ToolTip || selfClosed) return; } } -- cgit v1.2.3