From 77f10f7c5eb8716c06eb7e0447c3fd8dbcb48d79 Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 摹曛, 21 12月 2023 23:18:58 +0800
Subject: [PATCH] minor tweaks

---
 src/core/contexts/abstractwindowcontext.cpp |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/core/contexts/abstractwindowcontext.cpp b/src/core/contexts/abstractwindowcontext.cpp
index a568bfd..0d72e3c 100644
--- a/src/core/contexts/abstractwindowcontext.cpp
+++ b/src/core/contexts/abstractwindowcontext.cpp
@@ -81,6 +81,15 @@
         if (m_titleBar == item) {
             return false;
         }
+
+        if (m_titleBar) {
+            // Since the title bar is changed, all items inside it should be dereferenced right away
+            for (auto &button : m_systemButtons) {
+                button = nullptr;
+            }
+            m_hitTestVisibleItems.clear();
+        }
+
         m_titleBar = item;
         return true;
     }

--
Gitblit v1.9.1