mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
Fix crash when stopping screencast session twice
This commit is contained in:
@@ -27,6 +27,7 @@ pub struct Session {
|
||||
to_niri: calloop::channel::Sender<ScreenCastToNiri>,
|
||||
#[allow(clippy::type_complexity)]
|
||||
streams: Arc<Mutex<Vec<(Stream, InterfaceRef<Stream>)>>>,
|
||||
stopped: Arc<AtomicBool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Type, Clone, Copy)]
|
||||
@@ -135,6 +136,11 @@ impl Session {
|
||||
) {
|
||||
debug!("stop");
|
||||
|
||||
if self.stopped.swap(true, Ordering::SeqCst) {
|
||||
// Already stopped.
|
||||
return;
|
||||
}
|
||||
|
||||
Session::closed(&ctxt).await.unwrap();
|
||||
|
||||
if let Err(err) = self.to_niri.send(ScreenCastToNiri::StopCast {
|
||||
@@ -255,6 +261,7 @@ impl Session {
|
||||
ipc_outputs,
|
||||
streams: Arc::new(Mutex::new(vec![])),
|
||||
to_niri,
|
||||
stopped: Arc::new(AtomicBool::new(false)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user