From 3871bfc5d3aff45e498fa2944c27e6eb5d146c8e Mon Sep 17 00:00:00 2001 From: SineStriker <trueful@163.com> Date: 周三, 20 12月 2023 19:56:32 +0800 Subject: [PATCH] Add mac hot-switch implementations --- src/core/contexts/cocoawindowcontext.mm | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/core/contexts/cocoawindowcontext.mm b/src/core/contexts/cocoawindowcontext.mm index 79ad85e..c16c5a2 100644 --- a/src/core/contexts/cocoawindowcontext.mm +++ b/src/core/contexts/cocoawindowcontext.mm @@ -404,11 +404,18 @@ } void CocoaWindowContext::winIdChanged(QWindow *oldWindow, bool isDestroyed) { - releaseWindowProxy(windowId); + // If the original window id is valid, remove all resources related + if (windowId) { + releaseWindowProxy(windowId); + windowId = 0; + cocoaWindowEventFilter.reset(); + } + if (!m_windowHandle) { return; } + // Allocate new resources windowId = m_windowHandle->winId(); ensureWindowProxy(windowId)->setSystemTitleBarVisible(false); cocoaWindowEventFilter = std::make_unique<CocoaWindowEventFilter>(this, this); -- Gitblit v1.9.1