[gnome-documents/rhel-7.4: 12/16] lokview: Fix crash on repeated open of presentations
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/rhel-7.4: 12/16] lokview: Fix crash on repeated open of presentations
- Date: Fri, 9 Jun 2017 14:17:12 +0000 (UTC)
commit 3bd516524432f9decb0a15ab209a9957b7ae7488
Author: Caolán McNamara <caolanm redhat com>
Date: Mon May 8 16:44:32 2017 +0100
lokview: Fix crash on repeated open of presentations
Ensure prompt destruction of the LOKDocView widget when the view is
destroyed. This gives LOK a chance to shutdown at the right time.
https://bugzilla.gnome.org/show_bug.cgi?id=782508
src/lokview.js | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/lokview.js b/src/lokview.js
index 988db96..238832e 100644
--- a/src/lokview.js
+++ b/src/lokview.js
@@ -137,11 +137,19 @@ const LOKView = new Lang.Class({
this._lokview.connect('text-selection', Lang.bind(this, this._onTextSelection));
this._lokview.connect('notify::can-zoom-in', Lang.bind(this, this._onCanZoomInChanged));
this._lokview.connect('notify::can-zoom-out', Lang.bind(this, this._onCanZoomOutChanged));
+ this.connect('destroy', Lang.bind(this, this._destroyView));
}
return sw;
},
+ _destroyView: function() {
+ if (this._lokview) {
+ this._lokview.destroy();
+ this._lokview = null;
+ }
+ },
+
onLoadFinished: function(manager, doc) {
this.parent(manager, doc);
@@ -237,10 +245,10 @@ const LOKView = new Lang.Class({
},
get page() {
- return this._lokview.get_part();
+ return this._lokview ? this._lokview.get_part() : 0;
},
get numPages() {
- return this._lokview.get_parts();
+ return this._lokview ? this._lokview.get_parts() : 0;
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]