image-copy: Do not panic on ImageCaptureSourceKind::Destroyed
The way this was handled previously is incorrect. We should still handle creation of a capture session, just send `stopped` when it is created. This can be tested by creating a capture source and session for a workspace that has been removed. Toplevel and output sources have a different issue in `smithay`: https://github.com/Smithay/smithay/pull/1961 Should fix https://github.com/pop-os/cosmic-epoch/issues/3319.
This commit is contained in:
parent
b7c13369ee
commit
7fa5bd6b91
1 changed files with 14 additions and 7 deletions
|
|
@ -21,8 +21,9 @@ use smithay::{
|
|||
dmabuf::get_dmabuf,
|
||||
image_capture_source::ImageCaptureSource,
|
||||
image_copy_capture::{
|
||||
BufferConstraints, CursorSession, CursorSessionRef, DmabufConstraints, Frame, FrameRef,
|
||||
ImageCopyCaptureHandler, ImageCopyCaptureState, Session, SessionRef,
|
||||
BufferConstraints, CaptureFailureReason, CursorSession, CursorSessionRef,
|
||||
DmabufConstraints, Frame, FrameRef, ImageCopyCaptureHandler, ImageCopyCaptureState,
|
||||
Session, SessionRef,
|
||||
},
|
||||
seat::WaylandFocus,
|
||||
},
|
||||
|
|
@ -138,7 +139,9 @@ impl ImageCopyCaptureHandler for State {
|
|||
});
|
||||
toplevel.add_session(session);
|
||||
}
|
||||
ImageCaptureSourceKind::Destroyed => unreachable!(),
|
||||
ImageCaptureSourceKind::Destroyed => {
|
||||
session.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +261,9 @@ impl ImageCopyCaptureHandler for State {
|
|||
|
||||
toplevel.add_cursor_session(session);
|
||||
}
|
||||
ImageCaptureSourceKind::Destroyed => unreachable!(),
|
||||
ImageCaptureSourceKind::Destroyed => {
|
||||
session.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +289,9 @@ impl ImageCopyCaptureHandler for State {
|
|||
ImageCaptureSourceKind::Toplevel(toplevel) => {
|
||||
render_window_to_buffer(self, session, frame, &toplevel)
|
||||
}
|
||||
ImageCaptureSourceKind::Destroyed => unreachable!(),
|
||||
ImageCaptureSourceKind::Destroyed => {
|
||||
frame.fail(CaptureFailureReason::Stopped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -330,7 +337,7 @@ impl ImageCopyCaptureHandler for State {
|
|||
}
|
||||
}
|
||||
ImageCaptureSourceKind::Toplevel(mut toplevel) => toplevel.remove_session(&session),
|
||||
ImageCaptureSourceKind::Destroyed => unreachable!(),
|
||||
ImageCaptureSourceKind::Destroyed => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -361,7 +368,7 @@ impl ImageCopyCaptureHandler for State {
|
|||
ImageCaptureSourceKind::Toplevel(mut toplevel) => {
|
||||
toplevel.remove_cursor_session(&session)
|
||||
}
|
||||
ImageCaptureSourceKind::Destroyed => unreachable!(),
|
||||
ImageCaptureSourceKind::Destroyed => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue