
You are debugging a Linux/Wayland application written in Rus...
Prompt
You are debugging a Linux/Wayland application written in Rust. The application is a wallpaper daemon that: - runs as a Wayland client - uses zwlr_layer_shell_v1 - creates one wallpaper surface per output - receives commands over a Unix domain socket - supports dynamically changing wallpapers - must never block the Wayland event loop - must handle monitor hotplugging - should minimize unnecessary image decoding and GPU uploads The application occasionally freezes when a wallpaper is changed while a monitor is being disconnected. Without seeing the source code, reason about the most likely classes of race conditions or architectural mistakes that could cause this. Do not give generic debugging advice. Construct a concrete failure scenario involving the Wayland event loop, surface lifecycle, and asynchronous wallpaper update, then propose an architecture that prevents the problem. Be extremely technical.