Skip to content

Commit

Permalink
Do not clean trees in options context
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jan 29, 2019
1 parent 49ca7a7 commit a80bdc9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions holoviews/core/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def cleanup_custom_options(id, weakref=None):
unreferenced.
"""
try:
if Store._options_context:
return
weakrefs = Store._weakrefs.get(id, [])
if weakref in weakrefs:
weakrefs.remove(weakref)
Expand Down Expand Up @@ -1227,6 +1229,7 @@ class Store(object):

# Weakrefs to record objects per id
_weakrefs = {}
_options_context = False

# A list of hooks to call after registering the plot and style options
option_setters = []
Expand Down Expand Up @@ -1812,12 +1815,14 @@ def options(cls, obj, options=None, **kwargs):
"""
if (options is None) and kwargs == {}: yield
else:
Store._options_context = True
optstate = cls.state(obj)
groups = Store.options().groups.keys()
options = cls.merge_options(groups, options, **kwargs)
cls.set_options(obj, options)
yield
if options is not None:
Store._options_context = True
cls.state(obj, state=optstate)


Expand Down

0 comments on commit a80bdc9

Please sign in to comment.