Cocoa: remove current contentView when clearing window

Otherwise they might be still events sent to view with no
proper QWindow. Also, add dealloc QNSView for clean up.

Task-number: QTBUG-26580
Task-number: QTBUG-27456
Change-Id: Icdbe5c39490b72ec82795c2d71e5671cea81921e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
Teemu Katajisto 2012-10-10 16:05:22 +03:00 committed by The Qt Project
parent 932bf57ea2
commit 037d1e18e3
2 changed files with 9 additions and 0 deletions

View File

@ -713,6 +713,7 @@ void QCocoaWindow::setNSWindow(NSWindow *window)
void QCocoaWindow::clearNSWindow(NSWindow *window)
{
[window setContentView:nil];
[window setDelegate:nil];
[window clearPlatformWindow];
[[NSNotificationCenter defaultCenter] removeObserver:m_contentView];

View File

@ -89,6 +89,14 @@ static QTouchDevice *touchDevice = 0;
return self;
}
- (void)dealloc
{
CGImageRelease(m_cgImage);
m_cgImage = 0;
m_window = 0;
[super dealloc];
}
- (id)initWithQWindow:(QWindow *)window platformWindow:(QCocoaWindow *) platformWindow
{
self = [self init];