From 327055934009dc416be6234db8e4d26fab81fb80 Mon Sep 17 00:00:00 2001
From: SineStriker <55847490+SineStriker@users.noreply.github.com>
Date: 摹曛, 21 12月 2023 23:21:28 +0800
Subject: [PATCH] Merge pull request #8 from stdware/stylesupport

---
 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