Prevent Wayland crash in working-area X11 code path#21
Open
slowriot wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a crash when running gpicview on non-X11 backends (notably native Wayland) by avoiding unconditional X11-specific GDK calls in the working-area detection code.
Changes:
- Wrap X11 header usage with
#ifdef GDK_WINDOWING_X11. - Gate the X11 workarea query path so it only runs when the active GDK display/screen are actually X11.
- Fall back to the existing “screen dimensions” path on non-X11 backends.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a crash when
gpicviewis run on non-X11 backends, notably native Wayland sessions. This is currently an issue on Gnome desktop in Debian Testing.Cause
gpicviewusessrc/working-area.cto query the desktop work area when choosing its initial window size and zoom mode. That code assumes the active GDK backend is X11 and unconditionally callsgdk_x11_display_get_xdisplay()/gdk_x11_screen_get_xscreen(). On Wayland, those assumptions are invalid, which can lead to a crash when opening an image.Fix
The fix is deliberately small: it keeps the existing X11 code path unchanged, but only uses it when the current display/screen are actually X11. On non-X11 backends, it returns the existing fallback path instead, which uses the screen dimensions.