2 parents 392649c + db8c066 commit 0e4555aCopy full SHA for 0e4555a
1 file changed
src-tauri/src/desktop/windows/resume.rs
@@ -32,7 +32,12 @@ unsafe extern "system" fn on_power_event(
32
if (event_type == PBT_APMRESUMEAUTOMATIC || event_type == PBT_APMRESUMESUSPEND)
33
&& !context.is_null()
34
{
35
- let tx = &*(context as *const mpsc::Sender<()>);
+ // SAFETY: `context` is the `Context` pointer we registered — a `Box`ed
36
+ // `mpsc::Sender<()>` that `run_watcher` keeps alive for the process lifetime
37
+ // (it parks holding `tx` and never unregisters), so the reference is valid.
38
+ // Non-null checked above. Edition 2024 requires the explicit block even in an
39
+ // `unsafe fn`.
40
+ let tx = unsafe { &*(context as *const mpsc::Sender<()>) };
41
let _ = tx.try_send(());
42
}
43
0 // NO_ERROR
0 commit comments