fix: UAF race between capturer clone and clear()

Signed-off-by: Steve3184 <77789906+Steve3184@users.noreply.github.com>
This commit is contained in:
Steve3184 2026-02-28 22:15:33 +08:00
parent 788c5d406c
commit 91eba100f5
2 changed files with 2 additions and 3 deletions

View file

@ -549,9 +549,6 @@ fn run(vs: VideoService) -> ResultType<()> {
let mut c = get_capturer(vs.source, display_idx, last_portable_service_running)?;
#[cfg(target_os = "linux")]
let _wayland_call_on_ret = {
// Increment active display count when starting
let _display_count = super::wayland::increment_active_display_count();
SimpleCallOnReturn {
b: true,
f: Box::new(|| {

View file

@ -349,6 +349,7 @@ pub(super) fn get_capturer_for_display(
{
let cap_map = CAP_DISPLAY_INFO.read().unwrap();
if let Some(&addr) = cap_map.get(&display_idx) {
increment_active_display_count();
return build_capturer_info(addr);
}
}
@ -383,6 +384,7 @@ pub(super) fn get_capturer_for_display(
"get_capturer_for_display: re-initialization succeeded for display {}.",
display_idx
);
increment_active_display_count();
build_capturer_info(addr)
} else {
bail!(