From cc21debd36869b26b3deeb711b0814c883147bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sat, 2 Mar 2024 17:21:14 +0100 Subject: [PATCH] Disconnect QWindowContainer::focusWindowChanged on destruction Regression after 9e78256579e8dc704066a98cb4816a1aab0e7e3b. Apparently the string based connection syntax is more lenient, as with PMF-style connects, we (correctly) get: ASSERT failure in QWindowContainer: "Called object is not of the correct type (class destructor may have already run)" when the QWidget destructor closes the QWindow and we get a synchronous callback from the platform that we've lost the focus window. Change-Id: I8f25b3b050e11913ec0f0941eaf831c88b4249f9 Reviewed-by: Christian Ehrlicher (cherry picked from commit 7ff1285e7a93d51e1f2a079ae33349906d9e9fea) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/kernel/qwindowcontainer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 1247c4c6a67..cfd785a82c2 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -245,6 +245,9 @@ QWindowContainer::~QWindowContainer() d->window->destroy(); delete d->window; + + disconnect(qGuiApp, &QGuiApplication::focusWindowChanged, + this, &QWindowContainer::focusWindowChanged); }