Do not store in placeholder data - it's up to the registering code itself to persist or use the weakref_partial implementation from the event system

This commit is contained in:
Roy Nieterau 2024-04-18 12:04:24 +02:00
parent d7b20dff37
commit edee279f15

View file

@ -1161,16 +1161,10 @@ class PlaceholderPlugin(object):
# Match placeholder order by default
order = placeholder.order
# We must persist the callback over time otherwise it will be removed
# by the event system as a valid function reference. We do that here
# always just so it's easier to develop plugins where callbacks might
# be partials or lambdas
placeholder.data.setdefault("callbacks", []).append(callback)
self.log.debug("Registering '%s' callback: %s", topic, callback)
self.builder.event_system.add_callback(topic, callback, order=order)
class PlaceholderItem(object):
"""Item representing single item in scene that is a placeholder to process.