macOS: Bail out early in case a popup is closed by a mouseDown
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ø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
70e7445dbe
commit
fc04905281
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user