Skip to content

FIX: Add version gate to GTK4 calls when necessary#29363

Merged
greglucas merged 1 commit into
matplotlib:mainfrom
greglucas:gtk4-guievent
Jan 6, 2025
Merged

FIX: Add version gate to GTK4 calls when necessary#29363
greglucas merged 1 commit into
matplotlib:mainfrom
greglucas:gtk4-guievent

Conversation

@greglucas

Copy link
Copy Markdown
Contributor

PR summary

get_current_event() calls within pygobject would cause segfaults. This was fixed in 3.47, so gate the guiEvent information to only access that method in versions that don't segfault.

closes #29350

PR checklist

@greglucas greglucas added this to the v3.10.1 milestone Dec 20, 2024
@tacaswell tacaswell added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Dec 20, 2024
Comment thread lib/matplotlib/backends/backend_gtk4.py Outdated

def __init__(self, figure=None):
super().__init__(figure=figure)
print("GI version", gi.version_info)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
print("GI version", gi.version_info)

stray debugging print.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I guess this confirms I was testing it locally with various gi versions ;) and this did work on both lower and upper

get_current_event() calls within pygobject would cause segfaults. This
was fixed in 3.47, so gate the guiEvent information to only access
that method in versions that don't segfault.

@timhoffm timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mypy failure is unrelated (#29362)

@tacaswell tacaswell closed this Jan 6, 2025
@tacaswell tacaswell reopened this Jan 6, 2025
@tacaswell

Copy link
Copy Markdown
Member

"power-cycled" to re-run against current main which should fix the mypy issues.

@greglucas greglucas merged commit cb2d928 into matplotlib:main Jan 6, 2025
@greglucas greglucas deleted the gtk4-guievent branch January 6, 2025 16:12
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jan 6, 2025
rcomer added a commit that referenced this pull request Jan 6, 2025
…363-on-v3.10.x

Backport PR #29363 on branch v3.10.x (FIX: Add version gate to GTK4 calls when necessary)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GUI: gtk 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.

[Bug]: Matplotlib causes segmentation fault when hovering mouse over graph

3 participants