From ea52ef870475883ec108767d8f183b8f9afaedb1 Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Wed, 30 Jul 2014 00:28:30 +0000 Subject: [PATCH] del Widget.widgets[seld.model_id] in close rather than in __del__ --- IPython/html/widgets/widget.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py index 3d1df8408..3a72d0de1 100644 --- a/IPython/html/widgets/widget.py +++ b/IPython/html/widgets/widget.py @@ -127,8 +127,6 @@ class Widget(LoggingConfigurable): def __del__(self): """Object disposal""" self.close() - del Widget.widgets[self.model_id] - self._comm = None #------------------------------------------------------------------------- # Properties @@ -166,9 +164,10 @@ class Widget(LoggingConfigurable): Closes the underlying comm. When the comm is closed, all of the widget views are automatically removed from the front-end.""" + del Widget.widgets[self.model_id] if self._comm is not None: self._comm.close() - + def send_state(self, key=None): """Sends the widget state, or a piece of it, to the front-end.