[gnome-documents] view: Stop listening to info-updated when an item is removed
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] view: Stop listening to info-updated when an item is removed
- Date: Thu, 20 Aug 2015 05:32:02 +0000 (UTC)
commit fa57dc6de09a9ffe781a5e662eb715067f410203
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Aug 19 14:06:56 2015 +0200
view: Stop listening to info-updated when an item is removed
Items that have been removed from DocumentManager can still emit the
signal due to any ongoing thumbnailing operation. This can cause
ViewModel to erroneously re-add an item that is supposed to have been
removed.
https://bugzilla.gnome.org/show_bug.cgi?id=726450
src/view.js | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/view.js b/src/view.js
index dc04de6..044b1d8 100644
--- a/src/view.js
+++ b/src/view.js
@@ -84,6 +84,7 @@ const ViewModel = new Lang.Class({
this.set_sort_column_id(Gd.MainColumns.MTIME,
Gtk.SortType.DESCENDING);
+ this._infoUpdatedIds = {};
this._resetCountId = 0;
this._mode = windowMode;
@@ -194,23 +195,31 @@ const ViewModel = new Lang.Class({
if (doc.rowRefs[this._rowRefKey])
return;
+ let infoUpdatedId = this._infoUpdatedIds[doc.id];
+ if (infoUpdatedId) {
+ doc.disconnect(infoUpdatedId);
+ delete this._infoUpdatedIds[doc.id];
+ }
+
let activeCollection = Application.documentManager.getActiveCollection();
let windowMode = Application.modeController.getWindowMode();
if (!activeCollection || this._mode != windowMode) {
if (this._mode == WindowMode.WindowMode.COLLECTIONS && !doc.collection
|| this._mode == WindowMode.WindowMode.DOCUMENTS && doc.collection) {
- doc.connect('info-updated', Lang.bind(this, this._onInfoUpdated));
+ this._infoUpdatedIds[doc.id] = doc.connect('info-updated', Lang.bind(this,
this._onInfoUpdated));
return;
}
}
this._addItem(doc);
- doc.connect('info-updated', Lang.bind(this, this._onInfoUpdated));
+ this._infoUpdatedIds[doc.id] = doc.connect('info-updated', Lang.bind(this, this._onInfoUpdated));
},
_onItemRemoved: function(source, doc) {
this._removeItem(doc);
+ doc.disconnect(this._infoUpdatedIds[doc.id]);
+ delete this._infoUpdatedIds[doc.id];
},
_resetCount: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]