From 84ea00d47049d882f2fabf1446ec6c6eb5fe3038 Mon Sep 17 00:00:00 2001 From: J-P Nurmi 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 Reviewed-by: Shawn Rutledge --- 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 ba5089a8bc..699b058932 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) {