Skip to content

Commit

Permalink
assert presence of some objects during WlBuffer creation
Browse files Browse the repository at this point in the history
  • Loading branch information
maximbaz committed Oct 25, 2024
1 parent 62380e9 commit 12ef249
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/frame/capturer/wayland.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,22 +361,14 @@ impl Dispatch<ZwpLinuxBufferParamsV1, ()> for Capturer {
) {
match event {
zwp_linux_buffer_params_v1::Event::Created { buffer } => {
if let Some(screencopy_frame) = state.screencopy_frame.take() {
screencopy_frame.copy(&buffer);
}
state.screencopy_frame.take().unwrap().copy(&buffer);
state.wl_buffer = Some(buffer);
if let Some(dmabuf_params) = state.dmabuf_params.take() {
dmabuf_params.destroy();
}
state.dmabuf_params.take().unwrap().destroy();
}
zwp_linux_buffer_params_v1::Event::Failed => {
log::error!("Failed creating WlBuffer");
if let Some(screencopy_frame) = state.screencopy_frame.take() {
screencopy_frame.destroy();
}
if let Some(dmabuf_params) = state.dmabuf_params.take() {
dmabuf_params.destroy();
}
state.screencopy_frame.take().unwrap().destroy();
state.dmabuf_params.take().unwrap().destroy();

thread::sleep(DELAY_FAILURE);
state.is_processing_frame = false;
Expand Down

0 comments on commit 12ef249

Please sign in to comment.