Skip to content

Conversation

@finetjul
Copy link
Member

@finetjul finetjul commented Mar 6, 2025

It's important to use WeakMethod in order to not have the method callbacks hold a reference onto the object and let the object be destroyed.

This does not work with decorators though...

@finetjul finetjul force-pushed the support-weakmethods branch from f750d93 to d053d34 Compare March 6, 2025 21:19
@finetjul
Copy link
Member Author

finetjul commented Mar 6, 2025

@jourdain shouldn't the decorators @state.change("...") and @controller.add("...") use weak refs on the decorated methods ?

@jourdain
Copy link
Collaborator

jourdain commented Mar 6, 2025

Not necessary but we could add @state.change_weak(...) and @controller.add_weak(...)

@finetjul
Copy link
Member Author

@jourdain can you please merge, I'll do a separate PR for the decorators

@jourdain jourdain merged commit db9c2a4 into Kitware:master Mar 10, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants