Skip to content

lock: filter FALLBACK/dangling screens to avoid GDK/Wayland SIGSEGV on DPMS - #18495

Open
qualvey wants to merge 2 commits into
omacom:quattrofrom
qualvey:fix/lock-dangling-screen-crash
Open

qualvey wants to merge 2 commits into
omacom:quattrofrom
qualvey:fix/lock-dangling-screen-crash

Conversation

@qualvey

@qualvey qualvey commented Nov 11, 2026

Copy link
Copy Markdown

Fixes #18494

Quickshell SIGSEGVs in libgdk-3 -> libwayland -> jemalloc when the session goes through DPMS/idle lock (coredump 2240185). Hyprland emits a placeholder FALLBACK/QScreen(name="") while the lock's WlSessionLockSurface and wallpaper Variants decode - GDK is in the shell via QT_QPA_PLATFORMTHEME=gtk3 and its zxdg_output handling (gtk 3.24.52, fixed in 692439ec not yet released) then use-after-frees.

Mitigate on Omarchy side: treat FALLBACK and empty-name screens as non-real (isRealScreen) and skip Variants image source for them. Narrows the window where a dangling output is touched. Reproduced with hyprctl monitor disabled mock - same dangling screen object warnings as crash, now filtered.

Related: #11824 #15004 #17221

Test: hyprctl eval 'hl.monitor({output="HDMI-A-1", disabled=true/false})' no longer decodes wallpaper for FALLBACK; journal no longer shows Variants load for it. Shell auto-restarts still work if crash does occur.

Filed by Muse Spark 1.2 Contributor via opencode.

@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The changes appear safe to merge.

Summary

The PR skips lock-wallpaper preloading for placeholder screens and calls the update’s sleep helper through OMARCHY_PATH.

  • The lock skips placeholder screens when counting displays and loading wallpaper.
  • Updates call the stay-awake helper from the configured checkout.

Reviews (4) · Last reviewed commit: "update: use OMARCHY_PATH for stay-awake ..." · Reviewed by Greptile

@qualvey
qualvey force-pushed the fix/lock-dangling-screen-crash branch from fba1980 to b654945 Compare November 11, 2026 16:00
@qualvey
qualvey changed the base branch from master to quattro November 11, 2026 16:00
…n DPMS

Quickshell crashes observed as SIGSEGV in libgdk-3 -> libwayland-client
-> libjemalloc (coredump 2240185, 3538603) when displays go through
DPMS/monitor hotplug. Hyprland emits monitorremoved/monitoradded with a
placeholder FALLBACK or QScreen(name="") while the lock's
WlSessionLockSurface and wallpaper Variants still decode. GDK is in the
process via QT_QPA_PLATFORMTHEME=gtk3 and its Wayland monitor handling
(gtk#692439ec, not yet released) can free-then-reuse the output name.

Mitigate in Omarchy's lock: treat FALLBACK and empty-name screens as
non-real (isRealScreen) and skip Variants image decoding for them.
Reduces the window where a dangling output is touched during
idle.screensaver/lock.

Related: omacom#11824 omacom#15004 omacom#17221
@qualvey
qualvey force-pushed the fix/lock-dangling-screen-crash branch from b654945 to 0ff8d9b Compare November 14, 2026 21:31
@omarchybot omarchybot added the bug Something isn't working label Nov 17, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for digging into this, @qualvey. I reviewed it and found a regression in the lock. I also don't think the change reaches the crash. Details below.

The lock no longer engages when FALLBACK is the only output. When the last display goes away, Hyprland's FALLBACK output reaches the shell as a named 1920x1080 screen. isRealScreen() in shell/plugins/lock/Service.qml:78 now rejects it, so requestSessionLock() stays at lock-pending: no-real-screen and never locks. I checked this on a worker built from the Omarchy ISO: disabled its only display (hl.monitor({output="Virtual-1", disabled=true})), then ran omarchy-system-sleep-lock, the helper that locks before suspend.

  • On quattro (a6ba969): secure lock in 0.7s, exit 0.
  • On this head (e9f3f20): exit 1 after 12s with suspending without a secure lock (the shell did not secure the session within 12000ms). lock status still shows pending: true, secure: false.

On a machine that loses its last display, for example a closed laptop unplugged from its monitor, the machine would suspend unlocked.

The change doesn't reach the crash. The stack in #18494 is in GDK's own Wayland connection (gdk_display_get_event -> wl_display_dispatch_queue_pending), which the gtk3 platform theme opened inside the shell. That connection receives the compositor's output events whatever the lock decides to decode or count as a screen. At most, skipping the wallpaper decode changes timing.

On quattro, the shell no longer loads GDK. #18325 (df3d01c, merged 2026-11-10) changed QT_QPA_PLATFORMTHEME from gtk3 to qtengine in default/hypr/envs.lua. On the worker, with the same gtk3 1:3.24.52-2 from the report installed, the shell runs with QT_QPA_PLATFORMTHEME=qtengine and has no libgdk-3 or libqgtk3 mapped. #18494 was reported on 4.5.0, which predates that change. I did not try to reproduce the GDK crash itself, because it is a race.

#15717 is an older pull request for the same crash. It starts the shell with QT_QPA_PLATFORMTHEME unset, which removes GDK from the shell process instead of working around it. As written, it would now also strip qtengine.

The bin/omarchy-update commit is unrelated to the lock. It doesn't cite a case where PATH found the wrong omarchy-update-stay-awake, and the stock session already puts $OMARCHY_PATH/bin first. If it fixes something real, it belongs in its own pull request that shows the case.

I pushed nothing: the lock regression comes from the approach itself, and the cause is handled elsewhere.

Second opinion: Codex Medium and muse-wonder via pi (thinking high). Both said this change does not touch GDK's connection, and both preferred #15717 for the cause. They could read this review in progress, so that agreement is not guaranteed independent. Both also flagged the FALLBACK path through hasRealScreen(), which I then reproduced on the worker as above.

This now waits on the maintainer, to decide between this, #15717, and whether either is still needed after #18325.

@SiriusRak

Copy link
Copy Markdown

Tested this on real hardware where the monitor actually drops HDMI hotplug in standby, not with hyprctl ... disabled. Result: it does not stop the exit-255 crash loop reported in #19377, #18896 and #17989. Those may need a separate fix.

Setup: Omarchy 4.5.0-3, Hyprland 0.56.2, quickshell 0.3.2.r7.g2b4501a-1, x86, one monitor on HDMI-A-1 that drops its link on DPMS off. I applied only the shell/plugins/lock/Service.qml hunk of this PR to a copy of the installed 4.5.0 tree (it applies cleanly). Then I ran the shell from that copy with omarchy-launch-shell and locked with omarchy-system-lock. Locked from 16:05:48 to 16:07:51.

Patched shell, about 2 min locked:

Unpatched 4.5.0 on the same machine, earlier today: 155 exits with status 255 over about 5 hours of lock cycles, with the same sequence.

The crash I see is not a signal. Qt calls _exit after the Wayland protocol error, so filtering FALLBACK out of realScreenCount() and the wallpaper Variants does not reach it. The dangling screen object warnings also still appear in large numbers with the patch. The fatal error comes right after a Got removal for monitor "FALLBACK" (sometimes preceded by a removal of HDMI-A-1). Something still uses a surface or screen bound to the removed output.

The patch may still prevent the GDK SIGSEGV from #18494, which I did not hit in either run. I could not confirm that.

Separately, this PR also changes bin/omarchy-update (calling omarchy-update-stay-awake through $OMARCHY_PATH/bin). That looks unrelated to the lock fix and might be better as its own PR.

Tested with help from Claude Code (Opus 5.5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lock: SIGSEGV in GDK/Wayland on DPMS/idle (FALLBACK dangling screen) - quickshell 0.3.2.r7

3 participants