From c482e11e1237514ce5a367f4a9768d0d4ba45321 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Fri, 15 May 2015 12:51:12 +0200 Subject: [PATCH] Fix a crash under Wayland We were crashing under the Wayland session when gnome-software was activated through the PK session interface. This commit fixes the crash and adds a runtime check to see if we're running the gtk+ X11 backend before calling X11 functions. https://bugzilla.redhat.com/show_bug.cgi?id=1221968 --- src/gs-application.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gs-application.c b/src/gs-application.c index de7ba3a..51fd8d5 100644 --- a/src/gs-application.c +++ b/src/gs-application.c @@ -450,6 +450,9 @@ install_resources_activated (GSimpleAction *action, gpointer data) { GsApplication *app = GS_APPLICATION (data); +#ifdef GDK_WINDOWING_X11 + GdkDisplay *display; +#endif GList *windows; GtkWindow *window = NULL; const gchar *mode; @@ -459,9 +462,13 @@ install_resources_activated (GSimpleAction *action, g_variant_get (parameter, "(&s^as&s)", &mode, &resources, &startup_id); #ifdef GDK_WINDOWING_X11 - if (startup_id != NULL && startup_id[0] != '\0') - gdk_x11_display_set_startup_notification_id (gdk_display_get_default (), - startup_id); + display = gdk_display_get_default (); + + if (GDK_IS_X11_DISPLAY (display)) { + if (startup_id != NULL && startup_id[0] != '\0') + gdk_x11_display_set_startup_notification_id (display, + startup_id); + } #endif windows = gtk_application_get_windows (GTK_APPLICATION (app)); -- 2.4.0