From 1c37e43a8e1a8cc7cf432546d27a2fcddf933260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 9 Dec 2020 19:16:34 +0100 Subject: [PATCH] macOS: Remove warning about KVO observers on QNSWindow/QNSPanel NSTitleBarView in Big Sur will observe the window it is in, but makes sure to remove these observers in viewWillMoveToWindow, as it should. To avoid spamming user logs with this warning we remove it. It was dubious what cases it would have caught anyways, as anyone trying to KVO observe properties Z of a child object Y of X.Y would need to track whether X changes its Y between adding and removing the observer. There are no guarantees that Y is stable, and this applies to an NSView's window property as well. Change-Id: I27a0d04625f96c4c5d382c39ac068721ce1e8f9d Reviewed-by: Alexandru Croitor (cherry picked from commit b58d6831de79ad21463e20c079093667918ee626) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qcocoawindow.mm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 272113545a1..d52343f0b8a 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1457,11 +1457,6 @@ void QCocoaWindow::recreateWindowIfNeeded() if ((isContentView() && !shouldBeContentView) || (recreateReason & PanelChanged)) { if (m_nsWindow) { qCDebug(lcQpaWindow) << "Getting rid of existing window" << m_nsWindow; - if (m_nsWindow.observationInfo) { - qCCritical(lcQpaWindow) << m_nsWindow << "has active key-value observers (KVO)!" - << "These will stop working now that the window is recreated, and will result in exceptions" - << "when the observers are removed. Break in QCocoaWindow::recreateWindowIfNeeded to debug."; - } [m_nsWindow closeAndRelease]; if (isContentView() && !isEmbeddedView) { // We explicitly disassociate m_view from the window's contentView,