summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcocoawindow_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qcocoawindow_mac.mm')
-rw-r--r--src/gui/kernel/qcocoawindow_mac.mm13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm
index 89f481f..8e62f02 100644
--- a/src/gui/kernel/qcocoawindow_mac.mm
+++ b/src/gui/kernel/qcocoawindow_mac.mm
@@ -128,12 +128,19 @@ QT_USE_NAMESPACE
- (void)sendEvent:(NSEvent *)event
{
- [self retain];
-
QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
+
+ // Cocoa can hold onto the window after we've disavowed its knowledge. So,
+ // if we get sent an event afterwards just have it go through the super's
+ // version and don't do any stuff with Qt.
+ if (!widget) {
+ [super sendEvent:event];
+ return;
+ }
+
+ [self retain];
QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_nativeview_for(widget));
Qt::MouseButton mouseButton = cocoaButton2QtButton([event buttonNumber]);
-
// sometimes need to redirect mouse events to the popup.
QWidget *popup = qAppInstance()->activePopupWidget();
if (popup && popup != widget) {