screencopy: Handle error from with_buffer_contents_mut

Fixes https://github.com/pop-os/cosmic-comp/issues/48.

https://github.com/Smithay/smithay/pull/1475 fixes the segfault so this
instead produces an error. Then we need to handle the error here.
This commit is contained in:
Ian Douglas Scott 2024-07-03 14:35:32 -07:00 committed by Victoria Brekenfeld
parent f02520c194
commit 9f8fec6ec5
3 changed files with 7 additions and 4 deletions

2
Cargo.lock generated
View file

@ -4856,7 +4856,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "smithay"
version = "0.3.0"
source = "git+https://github.com/smithay//smithay?rev=3731734#3731734d5a0409186a0475238ffe46e2835cee6d"
source = "git+https://github.com/smithay//smithay?rev=4171247#41712470abede74dab8a039ce048c70d56115ce6"
dependencies = [
"appendlist",
"ash 0.38.0+1.3.281",

View file

@ -119,4 +119,4 @@ inherits = "release"
lto = "fat"
[patch."https://github.com/Smithay/smithay.git"]
smithay = {git = "https://github.com/smithay//smithay", rev = "3731734"}
smithay = {git = "https://github.com/smithay//smithay", rev = "4171247"}

View file

@ -9,7 +9,7 @@ use smithay::{
utils::{Relocate, RelocateRenderElement},
AsRenderElements, RenderElement,
},
gles::GlesRenderbuffer,
gles::{GlesError, GlesRenderbuffer},
sync::SyncPoint,
utils::with_renderer_surface_state,
Bind, Blit, BufferType, ExportMem, ImportAll, ImportMem, Offscreen, Renderer,
@ -63,6 +63,7 @@ pub fn submit_buffer<R>(
) -> Result<Option<(Frame, Vec<Rectangle<i32, BufferCoords>>)>, <R as Renderer>::Error>
where
R: ExportMem,
<R as Renderer>::Error: FromGlesError,
{
let Some(damage) = damage else {
frame.success(
@ -113,7 +114,8 @@ where
}
Ok(())
})
.unwrap()
.map_err(|err| <R as Renderer>::Error::from_gles_error(GlesError::BufferAccessError(err)))
.and_then(|x| x)
{
frame.fail(FailureReason::Unknown);
return Err(err);
@ -141,6 +143,7 @@ pub fn render_session<F, R>(
) -> Result<Option<(Frame, Vec<Rectangle<i32, BufferCoords>>)>, DTError<R>>
where
R: ExportMem,
<R as Renderer>::Error: FromGlesError,
F: for<'d> FnOnce(
&WlBuffer,
&mut R,