From 8fa6cb83c6301061d1397e4befd7150b2c7723b7 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 17 Dec 2013 09:42:35 +0100 Subject: cocoa: avoid sending windowNotification to a non-QNSView MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Then it's possible to embed native cocoa widgets without crashing. Task-number: QTBUG-35629 Change-Id: Ic212c36178282b4d090c6ce0470012adc8e0c2bb Reviewed-by: Morten Johan Sørvig Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 9 +++++---- 1 file 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]; -- cgit v1.2.3