You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By registering callbacks via add_event_handler, references to objects are stored and can prevent objects from being cleaned up. Is this behavior that we want, or should we use weakrefs?
The text was updated successfully, but these errors were encountered:
Store the given callback with a weakref. This would break e.g. lambdas and closures, so nah.
Store the callback, but (only) use a weakref if its a method. This could kinda work, but it can also feel inconsistent, especially since a closure can also hold a reference to an object.
Just store all callbacks by reference. If this is a problem, the caller can use weakrefs in a way that works for the use-case at hand.
I'm leaning hard towards option 3. Created #398 to "implement" that.
By registering callbacks via
add_event_handler
, references to objects are stored and can prevent objects from being cleaned up. Is this behavior that we want, or should we use weakrefs?The text was updated successfully, but these errors were encountered: