manager, listener-x11: Prevent session unlock bypass and trap transient X11 errors
This MR addresses two related issues that can leave the session unintentionally unlocked:
-
Immediate Lock on Activation: When
lock_timeout == 0andlock_with_saver_enabledis set,gs-managernow synchronously enablesmanager->priv->lock_active = TRUEprior to window creation, andgs-listener-x11emits thelocksignal directly onScreenSaverOnevents. This eliminates race conditions where the screen saver is active but the lock state has not engaged. -
Trap Transient X11 BadWindow on Dialog Cancellation: When the authentication dialog times out after 60 seconds (or is cancelled), the dialog socket window is destroyed while seat pointer regrabbing operations occur. On X11,
XIQueryPointer(request 131, minor 40) executed against the destroyed window produces an X11BadWindow (code 3)error. By default, GDK's error handler callsabort(), terminatingxfce4-screensaverand completely unlocking the user's desktop.This patch wraps seat grab movements with
gdk_x11_display_error_trap_push/pop_ignoredand installs a top-level X11 error handler (screensaver_x_error_handler) to trap transientBadWindow,BadMatch, andBadDrawableevents, preventing crashes and keeping the screensaver securely running.
Signed-off-by: Kalpesh Solanki skalpesh942@gmail.com
Fixes: #204 (closed)