[sushi] fallback-renderer: disconnect signals from the FileLoader on clear()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] fallback-renderer: disconnect signals from the FileLoader on clear()
- Date: Mon, 19 Mar 2012 20:40:37 +0000 (UTC)
commit 39ce30498aece7b4c43693f607d1c4017e20e4e9
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Mar 19 16:21:21 2012 -0400
fallback-renderer: disconnect signals from the FileLoader on clear()
Fixes some warnings when switching to another viewer.
src/js/ui/fallbackRenderer.js | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/src/js/ui/fallbackRenderer.js b/src/js/ui/fallbackRenderer.js
index cb2be69..ca7c947 100644
--- a/src/js/ui/fallbackRenderer.js
+++ b/src/js/ui/fallbackRenderer.js
@@ -40,6 +40,9 @@ function FallbackRenderer(args) {
FallbackRenderer.prototype = {
_init : function() {
+ this._fileLoader = null;
+ this._fileLoaderId = 0;
+
this.moveOnClick = true;
this.canFullScreen = false;
},
@@ -50,16 +53,10 @@ FallbackRenderer.prototype = {
this.lastHeight = 0;
this._fileLoader = new Sushi.FileLoader();
- this._fileLoader.connect("notify::size",
- Lang.bind(this, this._onFileInfoChanged));
- this._fileLoader.connect("notify::icon",
- Lang.bind(this, this._onFileInfoChanged));
- this._fileLoader.connect("notify::time",
- Lang.bind(this, this._onFileInfoChanged));
- this._fileLoader.connect("notify::name",
- Lang.bind(this, this._onFileInfoChanged));
-
this._fileLoader.file = file;
+ this._fileLoaderId =
+ this._fileLoader.connect("notify",
+ Lang.bind(this, this._onFileInfoChanged));
this._box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
spacing: 6 });
@@ -155,8 +152,13 @@ FallbackRenderer.prototype = {
},
clear : function() {
- this._fileLoader.stop();
- delete this._fileLoader;
+ if (this._fileLoader) {
+ this._fileLoader.disconnect(this._fileLoaderId);
+ this._fileLoaderId = 0;
+
+ this._fileLoader.stop();
+ this._fileLoader = null;
+ }
},
getSizeForAllocation : function(allocation) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]