Skip to content

Commit df3055b

Browse files
committed
Fixed callback proxy not being found on plugin reload
This happened due to the AutoUnload update a few days ago
1 parent 7fd4741 commit df3055b

File tree

1 file changed

+2
-21
lines changed
  • addons/source-python/packages/source-python/commands

1 file changed

+2
-21
lines changed

addons/source-python/packages/source-python/commands/command.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,11 @@ def __init__(self, names, *args, **kwargs):
2222
self.args = args
2323
self.kwargs = kwargs
2424
self.callback = None
25-
self._head_decorator = None
2625

2726
def __call__(self, callback):
2827
"""Register the commands to the given callback."""
29-
# Is there another registered decorator for the callback?
30-
if isinstance(callback, _BaseCommand):
31-
32-
# Store the callback
33-
self.callback = callback.callback
34-
35-
# Store the previous decorator instance
36-
self._head_decorator = callback
37-
38-
# Is this the first decorator registering the callback?
39-
else:
40-
41-
# Store the callback
42-
self.callback = callback
28+
# Store the callback
29+
self.callback = callback
4330

4431
# Register the commands
4532
self._manager_class.register_commands(
@@ -52,9 +39,3 @@ def _unload_instance(self):
5239
"""Unregister the commands."""
5340
# Unregister the commands
5441
self._manager_class.unregister_commands(self.names, self.callback)
55-
56-
# Was there another decorator for the callback?
57-
if self._head_decorator is not None:
58-
59-
# Unregister the other decorator
60-
self._head_decorator._unload_instance()

0 commit comments

Comments
 (0)