From 215ab0a984ea3be99bc7546580b9789920fdcef9 Mon Sep 17 00:00:00 2001 From: nevaforget Date: Tue, 2 Jun 2026 17:05:34 +0200 Subject: [PATCH] chore: drop unlock diagnostic instrumentation (v0.6.16) The per-unlock window-state dump was scaffolding to prove the stale-window hypothesis behind v0.6.15. With the fix in place, normal logging covers validation: the prune handler already logs on monitor removal, and coredumpctl shows whether the crash recurs. Remove the diagnostic block and its all_handles_dbg clone; restore all_handles to its original spot. --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 25 ++++--------------------- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d1261d1..a4d3b49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -575,7 +575,7 @@ dependencies = [ [[package]] name = "moonlock" -version = "0.6.15" +version = "0.6.16" dependencies = [ "gdk-pixbuf", "gdk4", diff --git a/Cargo.toml b/Cargo.toml index 7fcd026..9a70a5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moonlock" -version = "0.6.15" +version = "0.6.16" edition = "2024" description = "A secure Wayland lockscreen with GTK4, PAM and fingerprint support" license = "MIT" diff --git a/src/main.rs b/src/main.rs index 389b68f..a34f38f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -72,39 +72,18 @@ fn activate_with_session_lock( .and_then(|path| lockscreen::load_background_texture(&path)), ); - // Shared handles list — populated by connect_monitor, read by fingerprint init. - // Declared before unlock_callback so the callback can inspect window state on unlock. - let all_handles: Rc>> = - Rc::new(RefCell::new(Vec::new())); - // Shared unlock callback — unlocks session and quits. // Guard prevents double-unlock if PAM and fingerprint succeed simultaneously. let lock_clone = lock.clone(); let app_clone = app.clone(); let already_unlocked = Rc::new(Cell::new(false)); let au = already_unlocked.clone(); - let all_handles_dbg = all_handles.clone(); let unlock_callback: Rc = Rc::new(move || { if au.get() { log::debug!("Unlock already triggered, ignoring duplicate"); return; } au.set(true); - // DIAGNOSTIC: log lock-window state at unlock to confirm whether a stale - // window (unrealized / dead surface) remains in all_handles after a monitor - // power-off/resume. Remove once the resume-unlock crash is fixed. - { - let handles = all_handles_dbg.borrow(); - log::info!("UNLOCK: {} window(s) in all_handles", handles.len()); - for (i, h) in handles.iter().enumerate() { - log::info!( - "UNLOCK: window[{i}] realized={} mapped={} visible={}", - h.window.is_realized(), - h.window.is_mapped(), - h.window.is_visible(), - ); - } - } lock_clone.unlock(); app_clone.quit(); }); @@ -116,6 +95,10 @@ fn activate_with_session_lock( // Shared config for use in the monitor signal handler let config = Rc::new(config.clone()); + // Shared handles list — populated by connect_monitor, read by fingerprint init + let all_handles: Rc>> = + Rc::new(RefCell::new(Vec::new())); + // Shared fingerprint listener — None until async init completes. // The monitor handler checks this to wire up FP labels on hotplugged monitors. let shared_fp: Rc>>>> =