Short question:
Can signal handlers memory leak.
Long question:
In C#, if I attach a handler to an event
left_object.left_event += right_object.right_handler
Then I need to remove the handler when I get rid of right_object or the garbage collector will never dispose of it (since left_object.left_event retains a pointer to right_object)
Is the same also true of PyQt signals and slots.
left_object.left_signal.connect( right_object.right_handler )
I see from this question that Qt automatically delinks signals and slots, when the destructor of either left_object or right_object is called, but in Python I cannot explicitly call the destructor, and right_handler is a plain-old-function.
Do I need to remove the handler to prevent right_objects memory-leaking, or does PyQt use some sort of weak-referencing?
from Can signal handlers memory leak in PyQt?
No comments:
Post a Comment