From ceefcd1d32dbf4eab3b66abb84b4399c30d2cc39 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 3 Jul 2025 19:19:12 +0200 Subject: [PATCH] fix: crash on source capture with empty thumbnail size (#47651) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- shell/browser/api/electron_api_desktop_capturer.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/browser/api/electron_api_desktop_capturer.cc b/shell/browser/api/electron_api_desktop_capturer.cc index d0b3f40b5dcc..a5453ff8cd0f 100644 --- a/shell/browser/api/electron_api_desktop_capturer.cc +++ b/shell/browser/api/electron_api_desktop_capturer.cc @@ -233,7 +233,8 @@ DesktopCapturer::DesktopListListener::~DesktopListListener() = default; void DesktopCapturer::DesktopListListener::OnDelegatedSourceListSelection() { if (have_thumbnail_) { - std::move(update_callback_).Run(); + content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE, + std::move(update_callback_)); } else { have_selection_ = true; } @@ -246,7 +247,8 @@ void DesktopCapturer::DesktopListListener::OnSourceThumbnailChanged(int index) { have_selection_ = false; // PipeWire returns a single source, so index is not relevant. - std::move(update_callback_).Run(); + content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE, + std::move(update_callback_)); } else { have_thumbnail_ = true; }