From 9f8fec6ec57d9d1a2c465bf1d4f40ab08908994a Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 3 Jul 2024 14:35:32 -0700 Subject: [PATCH] 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. --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/wayland/handlers/screencopy/render.rs | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cfa3b0c8..f9e325db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/Cargo.toml b/Cargo.toml index a427a23e..e150e047 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"} diff --git a/src/wayland/handlers/screencopy/render.rs b/src/wayland/handlers/screencopy/render.rs index 652acb5c..63a73872 100644 --- a/src/wayland/handlers/screencopy/render.rs +++ b/src/wayland/handlers/screencopy/render.rs @@ -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( ) -> Result>)>, ::Error> where R: ExportMem, + ::Error: FromGlesError, { let Some(damage) = damage else { frame.success( @@ -113,7 +114,8 @@ where } Ok(()) }) - .unwrap() + .map_err(|err| ::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( ) -> Result>)>, DTError> where R: ExportMem, + ::Error: FromGlesError, F: for<'d> FnOnce( &WlBuffer, &mut R,