[gnome-software] Fix a crash under Wayland



commit 6c53eca8fda353f598f8561f61a3ae6956ddc194
Author: Kalev Lember <kalevlember gmail com>
Date:   Fri May 15 12:51:12 2015 +0200

    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 files 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));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]