Skip to content

Prevent Wayland crash in working-area X11 code path#21

Open
slowriot wants to merge 2 commits into
lxde:masterfrom
slowriot:master
Open

Prevent Wayland crash in working-area X11 code path#21
slowriot wants to merge 2 commits into
lxde:masterfrom
slowriot:master

Conversation

@slowriot
Copy link
Copy Markdown

This PR fixes a crash when gpicview is run on non-X11 backends, notably native Wayland sessions. This is currently an issue on Gnome desktop in Debian Testing.

Cause

gpicview uses src/working-area.c to 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 calls gdk_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.

  • This solution preserves current behavior on X11.
  • This solution avoids backend-specific calls on Wayland and other non-X11 backends.
  • It reuses the fallback behavior the file already had, rather than introducing new platform-specific logic.

Copilot AI review requested due to automatic review settings April 20, 2026 02:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread src/working-area.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants