summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-01-12 18:09:17 +0100
committerXavier Morel <xmo@openerp.com>2012-01-12 18:09:17 +0100
commit8f4a0277ac395f4e13724f1468e59559b204c8a1 (patch)
treedf7568abe9663e9b8145c3cacd60635213cd51cc /addons/web/static/src
parent378c20491b9679df3f55ee17b875fe2fde34af88 (diff)
[FIX] unbind handlers on records from a collection when the record is removed from the collection or the collection is reset
bzr revid: xmo@openerp.com-20120112170917-n6xadpzkbflk9s2c
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_list.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index 4e6adbf99cb..aa970c31649 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -1694,6 +1694,7 @@ var Collection = openerp.web.Class.extend(/** @lends Collection# */{
proxy.reset();
});
this._proxies = {};
+ _(this.records).invoke('unbind', null, this._onRecordEvent);
this.length = 0;
this.records = [];
this._byId = {};
@@ -1712,7 +1713,6 @@ var Collection = openerp.web.Class.extend(/** @lends Collection# */{
* @returns this
*/
remove: function (record) {
- var self = this;
var index = _(this.records).indexOf(record);
if (index === -1) {
_(this._proxies).each(function (proxy) {
@@ -1721,6 +1721,7 @@ var Collection = openerp.web.Class.extend(/** @lends Collection# */{
return this;
}
+ record.unbind(null, this._onRecordEvent);
this.records.splice(index, 1);
delete this._byId[record.get('id')];
this.length--;