-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix disconnection of callbacks when draggable artist is deparented. #25442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Once a draggable artist has been removed from its parent figure, we cannot access `self.canvas` (i.e. a property for `self.ref_artist.figure.canvas`) anymore to disconnect the relevant callbacks. Instead, we should keep track from the very beginning (in the DraggableBase constructor) of the place from which the callbacks should be disconnected.
self.canvas.callbacks._connect_picklable( | ||
'button_release_event', self.on_release), | ||
callbacks = ref_artist.figure._canvas_callbacks | ||
self._disconnectors = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to drop this in __getstate__
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The canvas
property has a note "property not attribute to keep pickable" which I understood to be because pickling the canvas was not always safe and this includes a reference to the canvas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no reference to the canvas, only to the figure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦🏻 I can not read (I was reading ref_artist.figure.canvas.callbacks
) and forget we moved the callback registry to live on the figure.
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
Fix disconnection of callbacks when draggable artist is deparented. (cherry picked from commit 370547e)
Backport in #25465. |
…3.7.x Backport PR #25442 on branch v3.7.x (Fix disconnection of callbacks when draggable artist is deparented.)
Once a draggable artist has been removed from its parent figure, we cannot access
self.canvas
(i.e. a property forself.ref_artist.figure.canvas
) anymore to disconnect the relevant callbacks. Instead, we should keep track from the very beginning (in the DraggableBase constructor) of the place from which the callbacks should be disconnected.Closes #25440.
Release critical as it's a regression due to #25311.
PR Summary
PR Checklist
Documentation and Tests
pytest
passes)Release Notes
.. versionadded::
directive in the docstring and documented indoc/users/next_whats_new/
.. versionchanged::
directive in the docstring and documented indoc/api/next_api_changes/
next_whats_new/README.rst
ornext_api_changes/README.rst