From a75d6d17f87861fbb7dd8b717a551e7e43a9f2c6 Mon Sep 17 00:00:00 2001
From: Lu YaNing <luyaning@uniontech.com>
Date: Wed, 8 May 2024 10:32:05 +0800
Subject: [PATCH] xcb: Avoid repeatedly registering xsettings callbacks When
 switching cursor themes, I found that xsettings callbacks are being
 registered repeatedly. When disconnecting the xsettings callback, only one
 can be disconnected.

---
 src/plugins/platforms/xcb/qxcbcursor.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 0670b6ebce1..4635c199d0d 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -562,7 +562,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
     xcb_cursor_t cursor = XCB_NONE;
 
 #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
-    if (m_screen->xSettings()->initialized()) {
+    if (!m_callbackForPropertyRegistered && m_screen->xSettings()->initialized()) {
         m_screen->xSettings()->registerCallbackForProperty("Gtk/CursorThemeName",cursorThemePropertyChanged,this);
         m_callbackForPropertyRegistered = true;
     }
-- 
GitLab

