From 5e6fcf293539cc7273ae48918375cae4619615d7 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Sun, 21 May 2017 14:44:12 -0500 Subject: [PATCH] Fix crash on startup Remove custom appstream screenshots --- font-view-ensure-window-exists.patch | 36 +++++++++++++++++++++++++++ font-view-hold-application.patch | 37 ++++++++++++++++++++++++++++ gnome-font-viewer.spec | 21 +++++++--------- 3 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 font-view-ensure-window-exists.patch create mode 100644 font-view-hold-application.patch diff --git a/font-view-ensure-window-exists.patch b/font-view-ensure-window-exists.patch new file mode 100644 index 0000000..f03f296 --- /dev/null +++ b/font-view-ensure-window-exists.patch @@ -0,0 +1,36 @@ +From 0beb4d974d87eb4d5c6175143e6a6c3534feb38a Mon Sep 17 00:00:00 2001 +From: Cosimo Cecchi +Date: Wed, 17 May 2017 12:11:56 -0700 +Subject: font-view: ensure the window exists when opening a file + +We refactored the initialization path, but forgot a case where the +window needs to be created during startup. + +https://bugzilla.gnome.org/show_bug.cgi?id=782738 +--- + src/font-view.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/font-view.c b/src/font-view.c +index 21aebf4..4a216c2 100644 +--- a/src/font-view.c ++++ b/src/font-view.c +@@ -88,6 +88,7 @@ static const GOptionEntry goption_options[] = + G_DEFINE_TYPE (FontViewApplication, font_view_application, GTK_TYPE_APPLICATION); + + static void font_view_application_do_overview (FontViewApplication *self); ++static void ensure_window (FontViewApplication *self); + + #define VIEW_ITEM_WIDTH 140 + #define VIEW_ITEM_WRAP_WIDTH 128 +@@ -737,6 +738,7 @@ query_info_ready_cb (GObject *object, + GFileInfo *info; + GError *error = NULL; + ++ ensure_window (self); + g_application_release (G_APPLICATION (self)); + + info = g_file_query_info_finish (G_FILE (object), res, &error); +-- +cgit v0.12 + diff --git a/font-view-hold-application.patch b/font-view-hold-application.patch new file mode 100644 index 0000000..383b73d --- /dev/null +++ b/font-view-hold-application.patch @@ -0,0 +1,37 @@ +From 51d9b31c07876857d105fa81d16c162b13aa8c3e Mon Sep 17 00:00:00 2001 +From: Cosimo Cecchi +Date: Wed, 17 May 2017 12:11:17 -0700 +Subject: font-view: make sure to hold the GApplication while doing async init + +Otherwise the application will shutdown during the query_info call. + +https://bugzilla.gnome.org/show_bug.cgi?id=782738 +--- + src/font-view.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/font-view.c b/src/font-view.c +index 898e53b..21aebf4 100644 +--- a/src/font-view.c ++++ b/src/font-view.c +@@ -737,6 +737,8 @@ query_info_ready_cb (GObject *object, + GFileInfo *info; + GError *error = NULL; + ++ g_application_release (G_APPLICATION (self)); ++ + info = g_file_query_info_finish (G_FILE (object), res, &error); + if (error != NULL) { + font_view_application_do_overview (self); +@@ -756,6 +758,8 @@ font_view_application_open (GApplication *application, + const gchar *hint) + { + FontViewApplication *self = FONT_VIEW_APPLICATION (application); ++ ++ g_application_hold (application); + g_file_query_info_async (files[0], G_FILE_ATTRIBUTE_STANDARD_NAME, + G_FILE_QUERY_INFO_NONE, + G_PRIORITY_DEFAULT, NULL, +-- +cgit v0.12 + diff --git a/gnome-font-viewer.spec b/gnome-font-viewer.spec index e61a8f6..bbb33fc 100644 --- a/gnome-font-viewer.spec +++ b/gnome-font-viewer.spec @@ -2,7 +2,7 @@ Name: gnome-font-viewer Version: 3.24.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Utility for previewing fonts for GNOME License: GPLv2+ @@ -10,6 +10,9 @@ License: GPLv2+ URL: http://www.gnome.org/gnome-3/ Source0: http://ftp.gnome.org/pub/GNOME/sources/gnome-font-viewer/%{release_version}/%{name}-%{version}.tar.xz +Patch0: font-view-hold-application.patch +Patch1: font-view-ensure-window-exists.patch + BuildRequires: gnome-desktop3-devel BuildRequires: gtk3-devel BuildRequires: intltool @@ -22,7 +25,7 @@ information about a specified font. You can use the Font Viewer to display the name, style, type, size, version and copyright of the font. %prep -%setup -q +%autosetup -p1 %build %configure --disable-silent-rules @@ -32,16 +35,6 @@ make %{?_smp_mflags} %install %make_install -# Update the screenshot shown in the software center -# -# NOTE: It would be *awesome* if this file was pushed upstream. -# -# See http://people.freedesktop.org/~hughsient/appdata/#screenshots for more details. -# -appstream-util replace-screenshots $RPM_BUILD_ROOT%{_datadir}/appdata/org.gnome.font-viewer.appdata.xml \ - https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/org.gnome.font-viewer/a.png \ - https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/org.gnome.font-viewer/b.png - %find_lang %{name} --with-gnome %check @@ -66,6 +59,10 @@ update-desktop-database &> /dev/null || : %changelog +* Sun May 21 2017 Michael Catanzaro - 3.24.0-2 +- Fix crash on startup +- Remove custom appstream screenshots + * Tue May 09 2017 Kalev Lember - 3.24.0-1 - Update to 3.24.0