Fix a crash under Wayland

https://bugzilla.redhat.com/show_bug.cgi?id=1221968
This commit is contained in:
Kalev Lember 2015-05-15 13:02:59 +02:00
parent b2f86e14df
commit e0edb350bd
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From c482e11e1237514ce5a367f4a9768d0d4ba45321 Mon Sep 17 00:00:00 2001
From: Kalev Lember <kalevlember@gmail.com>
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

View File

@ -7,7 +7,7 @@
Summary: A software center for GNOME
Name: gnome-software
Version: 3.16.2
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
Group: Applications/System
URL: https://wiki.gnome.org/Apps/Software
@ -17,6 +17,8 @@ Source0: http://download.gnome.org/sources/gnome-software/3.16/%{name}-%{versi
Patch0: gnome-software-system-apps.patch
# Downstream patch to adapt to gnome-terminal desktop file rename
Patch1: gnome-software-adapt-to-gnome-terminal-rename.patch
# Backported upstream patch for https://bugzilla.redhat.com/show_bug.cgi?id=1221968
Patch2: 0001-Fix-a-crash-under-Wayland.patch
Requires: appstream-data
%if 0%{?fedora}
@ -54,6 +56,7 @@ and update software in the GNOME desktop.
%setup -q
%patch0 -p1 -b .system-apps
%patch1 -p1 -b .gnome-terminal
%patch2 -p1
%build
%configure --disable-static
@ -108,6 +111,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/gnome-software/modulesets.d/*.xml
%changelog
* Fri May 15 2015 Kalev Lember <kalevlember@gmail.com> - 3.16.2-2
- Fix a crash under Wayland (#1221968)
* Mon May 11 2015 Kalev Lember <kalevlember@gmail.com> - 3.16.2-1
- Update to 3.16.2