summaryrefslogtreecommitdiff
path: root/source/l/qt5/patches/qt5.qtbug-55583.patch
blob: 804f538329aa8d450a1c93875fbab39350fb98f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
# https://github.com/qt/qtbase/commit/84ea00d4.patch
#
From 84ea00d47049d882f2fabf1446ec6c6eb5fe3038 Mon Sep 17 00:00:00 2001
From: J-P Nurmi <jpnurmi@qt.io>
Date: Tue, 6 Dec 2016 16:30:31 +0100
Subject: [PATCH] QGtk3Dialog: don't crash on Wayland

Check if it's an X11 window before calling XSetTransientForHint().
No transient parent will be set for GTK+ dialogs on Wayland. That
has to be implemented separately.

Task-number: QTBUG-55583
Change-Id: Iabc2a72681c8157bb2f2fe500892853aa397106b
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
---
 src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
index ba5089a..699b058 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
@@ -135,10 +135,12 @@ bool QGtk3Dialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWind
 
     GdkWindow *gdkWindow = gtk_widget_get_window(gtkWidget);
     if (parent) {
-        GdkDisplay *gdkDisplay = gdk_window_get_display(gdkWindow);
-        XSetTransientForHint(gdk_x11_display_get_xdisplay(gdkDisplay),
-                             gdk_x11_window_get_xid(gdkWindow),
-                             parent->winId());
+        if (GDK_IS_X11_WINDOW(gdkWindow)) {
+            GdkDisplay *gdkDisplay = gdk_window_get_display(gdkWindow);
+            XSetTransientForHint(gdk_x11_display_get_xdisplay(gdkDisplay),
+                                 gdk_x11_window_get_xid(gdkWindow),
+                                 parent->winId());
+        }
     }
 
     if (modality != Qt::NonModal) {