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>
This commit is contained in:
Shawn Rutledge 2013-12-17 09:42:35 +01:00 committed by The Qt Project
parent 443bdb5042
commit 8fa6cb83c6

View File

@ -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];