Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Don't bother disconnecting idle_draw at gtk shutdown. #15777

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

Merged
timhoffm merged 1 commit into matplotlib:master from anntzer:gtk3-shutdown
Dec 15, 2019

Conversation

Copy link
Contributor

@anntzer anntzer commented Nov 26, 2019

If the canvas has already been destroyed this leads to a warning
("Source ID xxx was not found when attempting to remove it").

repro:
MPLBACKEND=gtk3agg python -c 'from pylab import *; fig = plt.figure(); plot(); show(); fig.savefig("/tmp/test.png")'

This may cause an additional call to idle_draw(), but idle_draw() (via
draw()) first checks self.is_drawable() which would return False for
destroyed (thus not visible anymore) widgets
(https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-is-drawable)
so it's just a noop.

Closes #15773.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

If the canvas has already been destroyed this leads to a warning
("Source ID xxx was not found when attempting to remove it").
repro:
MPLBACKEND=gtk3agg python -c 'from pylab import *; fig = plt.figure(); plot(); show(); fig.savefig("/tmp/test.png")'
This may cause an additional call to idle_draw(), but idle_draw() (via
draw()) first checks `self.is_drawable()` which would return False for
destroyed (thus not visible anymore) widgets
(https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-is-drawable)
so it's just a noop.
Copy link

@bje- bje- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked for me.

bje- reacted with thumbs up emoji
@tacaswell tacaswell added this to the v3.3.0 milestone Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@tacaswell tacaswell tacaswell approved these changes

@timhoffm timhoffm timhoffm approved these changes

+1 more reviewer

@bje- bje- bje- left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
Projects
None yet
Milestone
v3.3.0
Development

Successfully merging this pull request may close these issues.

Warning:... GLib.source_remove(self._idle_draw_id) when using plt.savefig()

AltStyle によって変換されたページ (->オリジナル) /