From 91fd22b4a0d44fbb096af2714a2c85687e0a5312 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 16 May 2018 00:39:59 +0200 Subject: [PATCH] qgtkintegration: small fix to dcbf8b5225a08557dd50cfd36f512aad0c4d44dd when not running on x, we should be sure to return nullptr, otherwise we're going to have a bad time. --- src/platform-plugin/qgtkintegration.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platform-plugin/qgtkintegration.cpp b/src/platform-plugin/qgtkintegration.cpp index e4f8247..aab53ba 100644 --- a/src/platform-plugin/qgtkintegration.cpp +++ b/src/platform-plugin/qgtkintegration.cpp @@ -295,16 +295,18 @@ void *QGtkIntegration::nativeResourceForScreen(const QByteArray &resource, QScre rootwin_warned = true; } Display *dpy = nullptr; + xcb_screen_t *screen = nullptr; if (GDK_IS_X11_DISPLAY(m_display)) { dpy = gdk_x11_display_get_xdisplay(m_display); xcb_connection_t *conn = XGetXCBConnection(dpy); // use the first screen... hopefully this is okay? sigh... - xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(conn)).data; - result = reinterpret_cast(screen->root); + screen = xcb_setup_roots_iterator(xcb_get_setup(conn)).data; } else { qWarning() << "Can't get root X window, GDK_BACKEND is not X11."; } + + result = reinterpret_cast(screen ? screen->root : nullptr); #endif } else { qWarning() << "Unimplemented request for " << resource << " on " << screen;