Cocoa: Unregister view from window's notifications only
Otherwise the view will miss its own frame change notifications. And we must unregister from all the notifications during dealloc. This would also reveal a bug where we would expose an NSView before its super view is visible, leading to those "invalid drawable" warnings when using QQuickViews. Therefore, we add this extra check in QCocoaWindow::exposeWindow(). Task-number: QTBUG-32826 Change-Id: I69018cb6f199b242768d114b2aa34c7f2d243196 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
parent
a2bdda8e3b
commit
8fd71914b4
@ -911,7 +911,8 @@ void QCocoaWindow::clearNSWindow(NSWindow *window)
|
||||
[window setContentView:nil];
|
||||
[window setDelegate:nil];
|
||||
[window clearPlatformWindow];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:m_contentView];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:m_contentView
|
||||
name:nil object:window];
|
||||
}
|
||||
|
||||
// Returns the current global screen geometry for the nswindow associated with this window.
|
||||
@ -1023,7 +1024,7 @@ qreal QCocoaWindow::devicePixelRatio() const
|
||||
|
||||
void QCocoaWindow::exposeWindow()
|
||||
{
|
||||
if (!m_isExposed) {
|
||||
if (!m_isExposed && ![[m_contentView superview] isHidden]) {
|
||||
m_isExposed = true;
|
||||
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
|
||||
}
|
||||
|
@ -107,12 +107,9 @@ static QTouchDevice *touchDevice = 0;
|
||||
m_maskImage = 0;
|
||||
m_maskData = 0;
|
||||
m_window = 0;
|
||||
if (m_subscribesForGlobalFrameNotifications) {
|
||||
m_subscribesForGlobalFrameNotifications = false;
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:NSViewGlobalFrameDidChangeNotification
|
||||
object:self];
|
||||
}
|
||||
m_subscribesForGlobalFrameNotifications = false;
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
delete currentCustomDragTypes;
|
||||
|
||||
[super dealloc];
|
||||
|
Loading…
Reference in New Issue
Block a user