[sushi] audio: disconnect signals from the player on clear()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] audio: disconnect signals from the player on clear()
- Date: Mon, 19 Mar 2012 20:40:43 +0000 (UTC)
commit 275f05c943fb85c6205816aa77cf09a63b2ba322
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Mar 19 16:22:28 2012 -0400
audio: disconnect signals from the player on clear()
Fixes some warnings when switching from this viewer on to other viewers.
src/js/viewers/audio.js | 40 ++++++++++++++++++++++++----------------
1 files changed, 24 insertions(+), 16 deletions(-)
---
diff --git a/src/js/viewers/audio.js b/src/js/viewers/audio.js
index 421fa8d..fe89168 100644
--- a/src/js/viewers/audio.js
+++ b/src/js/viewers/audio.js
@@ -89,29 +89,37 @@ AudioRenderer.prototype = {
},
_createPlayer : function(file) {
+ this._playerNotifies = [];
+
this._player = new Sushi.SoundPlayer({ uri: file.get_uri() });
this._player.playing = true;
- this._player.connect("notify::progress",
- Lang.bind(this,
- this._onPlayerProgressChanged));
- this._player.connect("notify::duration",
- Lang.bind(this,
- this._onPlayerDurationChanged));
- this._player.connect("notify::state",
- Lang.bind(this,
- this._onPlayerStateChanged));
- this._player.connect("notify::taglist",
- Lang.bind(this,
- this._onTagListChanged));
- this._player.connect("notify::cover",
- Lang.bind(this,
- this._onCoverArtChanged));
+ this._playerNotifies.push(
+ this._player.connect("notify::progress",
+ Lang.bind(this, this._onPlayerProgressChanged)));
+ this._playerNotifies.push(
+ this._player.connect("notify::duration",
+ Lang.bind(this, this._onPlayerDurationChanged)));
+ this._playerNotifies.push(
+ this._player.connect("notify::state",
+ Lang.bind(this, this._onPlayerStateChanged)));
+ this._playerNotifies.push(
+ this._player.connect("notify::taglist",
+ Lang.bind(this, this._onTagListChanged)));
+ this._playerNotifies.push(
+ this._player.connect("notify::cover",
+ Lang.bind(this, this._onCoverArtChanged)));
},
clear : function(file) {
+ this._playerNotifies.forEach(Lang.bind(this,
+ function(id) {
+ this._player.disconnect(id);
+ }));
+
this._player.playing = false;
- delete this._player;
+ this._playerNotifies = [];
+ this._player = null;
},
_ensurePixbufSize : function(cover) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]