From e877da587234089455bf47489cf08c493a9429f2 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Wed, 23 Sep 2026 18:03:36 +0800 Subject: [PATCH] scrap: release the frame through the state machine when abandoning the tone-map master's FrameState machine is left at Acquired by the raw ReleaseFrame(), so the next release_frame() hits DXGI_ERROR_INVALID_CALL on the fresh duplication and the capture loop falls back to GDI -- the outcome the fallback exists to avoid. Co-Authored-By: Claude Fable 5.1 --- libs/scrap/src/dxgi/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/scrap/src/dxgi/mod.rs b/libs/scrap/src/dxgi/mod.rs index c83230e0a..20c994eb9 100644 --- a/libs/scrap/src/dxgi/mod.rs +++ b/libs/scrap/src/dxgi/mod.rs @@ -264,7 +264,9 @@ impl Capturer { } hbb_common::log::error!("HDR tone-map failed, re-duplicating without it: {err}"); self.hdr = None; - (*self.duplication.0).ReleaseFrame(); + if let Err(release_err) = self.release_frame() { + hbb_common::log::warn!("DXGI frame cleanup failed while disabling HDR: {release_err}"); + } self.duplication = ComPtr(ptr::null_mut()); let mut duplication = ptr::null_mut(); let result = wrap_hresult(