Fix Sushi crash with undefined getters

Related: #1880752
This commit is contained in:
Felipe Borges 2020-09-23 13:15:42 +02:00
parent 86c5fdca0c
commit 0832e73333
2 changed files with 164 additions and 1 deletions

156
sushi-define-getters.patch Normal file
View File

@ -0,0 +1,156 @@
From 47736b0547e40b543cdf0c6aab167f81da57bd1b Mon Sep 17 00:00:00 2001
From: Felipe Borges <felipeborges@gnome.org>
Date: Wed, 23 Sep 2020 12:59:53 +0200
Subject: [PATCH] viewers: Implement getters in the viewers child classes
I have no idea why the getters defined in Renderer.Renderer are not
inherited by their derived classes. I am not very versed in modern
GJS, neither interested much in it.
This fixes sushi tho. :)
---
src/viewers/evince.js | 8 ++++++++
src/viewers/font.js | 8 ++++++++
src/viewers/gst.js | 8 ++++++++
src/viewers/html.js | 8 ++++++++
src/viewers/image.js | 8 ++++++++
src/viewers/libreoffice.js | 8 ++++++++
src/viewers/text.js | 8 ++++++++
7 files changed, 56 insertions(+)
diff --git a/src/viewers/evince.js b/src/viewers/evince.js
index 5330eea..9eb36a9 100644
--- a/src/viewers/evince.js
+++ b/src/viewers/evince.js
@@ -42,6 +42,14 @@ var Klass = GObject.registerClass({
false)
},
}, class EvinceRenderer extends Gtk.ScrolledWindow {
+ get ready() {
+ return !!this._ready;
+ }
+
+ get fullscreen() {
+ return !!this._fullscreen;
+ }
+
_init(file, fileInfo) {
super._init({ visible: true,
min_content_height: Constants.VIEW_MIN,
diff --git a/src/viewers/font.js b/src/viewers/font.js
index 9bba13d..330c92b 100644
--- a/src/viewers/font.js
+++ b/src/viewers/font.js
@@ -38,6 +38,14 @@ var Klass = GObject.registerClass({
false)
},
}, class FontRenderer extends Sushi.FontWidget {
+ get ready() {
+ return !!this._ready;
+ }
+
+ get fullscreen() {
+ return !!this._fullscreen;
+ }
+
_init(file) {
super._init({ uri: file.get_uri(),
visible: true })
diff --git a/src/viewers/gst.js b/src/viewers/gst.js
index 14d4b00..0c5654a 100644
--- a/src/viewers/gst.js
+++ b/src/viewers/gst.js
@@ -39,6 +39,14 @@ var Klass = GObject.registerClass({
false)
},
}, class GstRenderer extends Sushi.MediaBin {
+ get ready() {
+ return !!this._ready;
+ }
+
+ get fullscreen() {
+ return !!this._fullscreen;
+ }
+
_init(file) {
super._init({ uri: file.get_uri() });
diff --git a/src/viewers/html.js b/src/viewers/html.js
index a20d55d..3de4455 100644
--- a/src/viewers/html.js
+++ b/src/viewers/html.js
@@ -38,6 +38,14 @@ var Klass = GObject.registerClass({
false)
},
}, class HTMLRenderer extends WebKit2.WebView {
+ get ready() {
+ return !!this._ready;
+ }
+
+ get fullscreen() {
+ return !!this._fullscreen;
+ }
+
_init(file) {
super._init();
diff --git a/src/viewers/image.js b/src/viewers/image.js
index bae07cd..8befc05 100644
--- a/src/viewers/image.js
+++ b/src/viewers/image.js
@@ -38,6 +38,14 @@ var Klass = GObject.registerClass({
false)
},
}, class ImageRenderer extends Gtk.DrawingArea {
+ get ready() {
+ return !!this._ready;
+ }
+
+ get fullscreen() {
+ return !!this._fullscreen;
+ }
+
_init(file) {
super._init();
diff --git a/src/viewers/libreoffice.js b/src/viewers/libreoffice.js
index d153223..8302b4e 100644
--- a/src/viewers/libreoffice.js
+++ b/src/viewers/libreoffice.js
@@ -24,6 +24,14 @@ var Klass = GObject.registerClass({
false)
},
}, class LibreofficeRenderer extends Gtk.ScrolledWindow {
+ get ready() {
+ return !!this._ready;
+ }
+
+ get fullscreen() {
+ return !!this._fullscreen;
+ }
+
_init(file) {
super._init({ hexpand: true,
visible: true,
diff --git a/src/viewers/text.js b/src/viewers/text.js
index 52d4b17..c621efd 100644
--- a/src/viewers/text.js
+++ b/src/viewers/text.js
@@ -38,6 +38,14 @@ var Klass = GObject.registerClass({
false)
},
}, class TextRenderer extends Gtk.ScrolledWindow {
+ get ready() {
+ return !!this._ready;
+ }
+
+ get fullscreen() {
+ return !!this._fullscreen;
+ }
+
_init(file, fileInfo) {
super._init();
--
2.28.0

View File

@ -1,12 +1,14 @@
Name: sushi
Version: 3.34.0
Release: 3%{?dist}
Release: 4%{?dist}
Summary: A quick previewer for Nautilus
License: GPLv2+ with exceptions
URL: https://gitlab.gnome.org/GNOME/sushi
Source0: https://download.gnome.org/sources/%{name}/3.34/%{name}-%{version}.tar.xz
Patch0: sushi-define-getters.patch
BuildRequires: gettext
BuildRequires: gjs-devel
BuildRequires: meson
@ -30,6 +32,7 @@ file manager.
%prep
%setup -q
%patch0 -p1
%build
@ -54,6 +57,10 @@ file manager.
%changelog
* Wed Sep 23 2020 Felipe Borges <feborges@redhat.com> - 3.34.0-4
- Fix crash
- Related: #1880752
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.34.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild