diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dbus/mutter_screen_cast.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dbus/mutter_screen_cast.rs b/src/dbus/mutter_screen_cast.rs index 853fe4ae..9c7ffb28 100644 --- a/src/dbus/mutter_screen_cast.rs +++ b/src/dbus/mutter_screen_cast.rs @@ -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)), } } } |
