Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: make the cache in font_manager._get_font keyed by thread id #19618

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
merged 1 commit into from
Mar 6, 2021

Conversation

tacaswell
Copy link
Member

PR Summary

This prevents segfaults when multiple threads try to manipulate the
FT2Font object simultaneously.

closes #19560

Co-authored-by: Antony Lee [email protected]

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).

@tacaswell tacaswell added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Mar 2, 2021
@tacaswell tacaswell added this to the v3.4.0 milestone Mar 2, 2021
@tacaswell tacaswell force-pushed the fix_font_segfault branch 2 times, most recently from f9126fa to 1a9c38b Compare March 4, 2021 05:44
@QuLogic
Copy link
Member

QuLogic commented Mar 4, 2021

Instead of a string, you probably want to use inspect, like the backend test: https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/tests/test_backends_interactive.py#L167

@tacaswell tacaswell force-pushed the fix_font_segfault branch 2 times, most recently from 824c15c to ad7a793 Compare March 5, 2021 22:29
This prevents segfaults when multiple threads try to manipulate the
FT2Font object simultaneously.

closes matplotlib#19560

Co-authored-by: Antony Lee <[email protected]>
@tacaswell tacaswell force-pushed the fix_font_segfault branch from ad7a793 to b993ad4 Compare March 6, 2021 01:01
@QuLogic QuLogic merged commit c15c585 into matplotlib:master Mar 6, 2021
@QuLogic
Copy link
Member

QuLogic commented Mar 6, 2021

@meeseeksdev backport to v3.4.x

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 6, 2021
QuLogic added a commit that referenced this pull request Mar 6, 2021
…618-on-v3.4.x

Backport PR #19618 on branch v3.4.x (FIX: make the cache in font_manager._get_font keyed by thread id)
@tacaswell tacaswell deleted the fix_font_segfault branch May 5, 2021 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

segfault due to font objects when multi-threading
3 participants