Skip to content

Commit

Permalink
dev-qt/qtgui: Add upstream pending fix
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Sturmlechner <[email protected]>
  • Loading branch information
a17r committed Nov 15, 2022
1 parent 37d503a commit fd34432
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
From c78370cabc56668f45bdc2e96eaa8a1565d52c85 Mon Sep 17 00:00:00 2001
From: David Edmundson <[email protected]>
Date: Mon, 17 Oct 2022 22:18:58 +0100
Subject: [PATCH] xcb: correctly disconnect xsettings callbacks

registerCallbackForProperty can be initialized without us completely
initialializing a GTK theme. We need a different guard for the
destructor.

(part cherry-picked from 012132c60d625b2de0039bdda3c22a0a8fe2dfe5)
---
src/plugins/platforms/xcb/qxcbcursor.cpp | 8 +++++---
src/plugins/platforms/xcb/qxcbcursor.h | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 4210bf428e..0670b6ebce 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -300,7 +300,7 @@ QXcbCursorCacheKey::QXcbCursorCacheKey(const QCursor &c)
#endif // !QT_NO_CURSOR

QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
- : QXcbObject(conn), m_screen(screen), m_gtkCursorThemeInitialized(false)
+ : QXcbObject(conn), m_screen(screen), m_gtkCursorThemeInitialized(false), m_callbackForPropertyRegistered(false)
{
#if QT_CONFIG(cursor)
// see NUM_BITMAPS in libXcursor/src/xcursorint.h
@@ -343,7 +343,7 @@ QXcbCursor::~QXcbCursor()
{
xcb_connection_t *conn = xcb_connection();

- if (m_gtkCursorThemeInitialized) {
+ if (m_callbackForPropertyRegistered) {
m_screen->xSettings()->removeCallbackForHandle(this);
}

@@ -562,8 +562,10 @@ 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_screen->xSettings()->initialized()) {
m_screen->xSettings()->registerCallbackForProperty("Gtk/CursorThemeName",cursorThemePropertyChanged,this);
+ m_callbackForPropertyRegistered = true;
+ }

// Try Xcursor first
if (cshape >= 0 && cshape <= Qt::LastCursor) {
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h
index 0b238823f0..82fb47e55d 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.h
+++ b/src/plugins/platforms/xcb/qxcbcursor.h
@@ -122,6 +122,7 @@ private:
void *handle);
#endif
bool m_gtkCursorThemeInitialized;
+ bool m_callbackForPropertyRegistered;
};

QT_END_NAMESPACE
--
GitLab

8 changes: 7 additions & 1 deletion dev-qt/qtgui/qtgui-5.15.7.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ PDEPEND="
"

# workaround the fact that QT_CONFIG(dbus) does not work for us
PATCHES=( "${FILESDIR}/${P}-fix-no-dbus.patch" )
PATCHES=(
# Pending:
# https://invent.kde.org/qt/qt/qtbase/-/merge_requests/211
"${FILESDIR}/${P}-xcb-correctly-disconnect-xsettings-callbacks.patch"
# Downstream:
"${FILESDIR}/${P}-fix-no-dbus.patch"
)

QT5_TARGET_SUBDIRS=(
src/tools/qvkgen
Expand Down

0 comments on commit fd34432

Please sign in to comment.