summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-12-17 09:42:35 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-23 12:16:57 +0100
commit8fa6cb83c6301061d1397e4befd7150b2c7723b7 (patch)
tree207f15c529b1a11b241a3efc0541ff200b1e793f
parent443bdb5042e1570b32bb8d71f18a18a895321264 (diff)
cocoa: avoid sending windowNotification to a non-QNSView
Then it's possible to embed native cocoa widgets without crashing. Task-number: QTBUG-35629 Change-Id: Ic212c36178282b4d090c6ce0470012adc8e0c2bb Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index a2ef43db67..ad11a525ad 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -942,10 +942,11 @@ void QCocoaWindow::setNSWindow(NSWindow *window)
[window setReleasedWhenClosed : NO];
- [[NSNotificationCenter defaultCenter] addObserver:m_contentView
- selector:@selector(windowNotification:)
- name:nil // Get all notifications
- object:m_nsWindow];
+ if (m_qtView)
+ [[NSNotificationCenter defaultCenter] addObserver:m_qtView
+ selector:@selector(windowNotification:)
+ name:nil // Get all notifications
+ object:m_nsWindow];
[m_contentView setPostsFrameChangedNotifications: NO];
[window setContentView:m_contentView];