From 1900ef3c9805d7fe15e0634cef9b5ff2a5dc7838 Mon Sep 17 00:00:00 2001 From: SineStriker <trueful@163.com> Date: 周三, 20 12月 2023 20:02:05 +0800 Subject: [PATCH] minor tweaks --- src/core/contexts/cocoawindowcontext.mm | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/src/core/contexts/cocoawindowcontext.mm b/src/core/contexts/cocoawindowcontext.mm index cbfed18..c16c5a2 100644 --- a/src/core/contexts/cocoawindowcontext.mm +++ b/src/core/contexts/cocoawindowcontext.mm @@ -7,6 +7,7 @@ #include "qwkglobal_p.h" #include "systemwindow_p.h" + namespace QWK { struct NSWindowProxy { @@ -221,6 +222,7 @@ static inline void releaseWindowProxy(const WId windowId) { if (const auto proxy = g_proxyList()->take(windowId)) { + proxy->setSystemTitleBarVisible(true); delete proxy; } } @@ -402,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