From 1204af464b8b08d75c26ccfc72fd9fc762e4b01e Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Fri, 26 Sep 2014 19:04:55 +0000 Subject: [PATCH] on("destroy",...) -> once("destroy",...) so we don't keep a reference to it, preventing gc Thanks to Sylvain Corlay for the suggestion. --- IPython/html/static/widgets/js/widget_link.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/html/static/widgets/js/widget_link.js b/IPython/html/static/widgets/js/widget_link.js index 7ee00d498..ba76dbd36 100644 --- a/IPython/html/static/widgets/js/widget_link.js +++ b/IPython/html/static/widgets/js/widget_link.js @@ -11,7 +11,7 @@ define([ this.update_bindings(model.previous("widgets") || [], value); this.update_value(this.get("widgets")[0]); }, this); - this.on("destroy", function(model, collection, options) { + this.once("destroy", function(model, collection, options) { this.update_bindings(this.get("widgets"), []); }, this); }, @@ -46,7 +46,7 @@ define([ var DirectionalLinkModel = widget.WidgetModel.extend({ initialize: function() { this.on("change", this.update_bindings, this); - this.on("destroy", function() { + this.once("destroy", function() { if (this.source) { this.source[0].off("change:" + this.source[1], null, this); }