fix: multiple move() calls on the same unique_ptr (#42821)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2024-07-08 13:48:47 -04:00 committed by GitHub
parent e36d79706e
commit 50864bcd08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -343,13 +343,12 @@ void ElectronExtensionsBrowserClient::BroadcastEventToRenderers(
return; return;
} }
auto event = std::make_unique<extensions::Event>(histogram_value, event_name,
args.Clone());
for (auto const& [key, browser_context] : for (auto const& [key, browser_context] :
ElectronBrowserContext::browser_context_map()) { ElectronBrowserContext::browser_context_map()) {
if (browser_context) { if (browser_context) {
extensions::EventRouter::Get(browser_context.get()) extensions::EventRouter::Get(browser_context.get())
->BroadcastEvent(std::move(event)); ->BroadcastEvent(std::make_unique<extensions::Event>(
histogram_value, event_name, args.Clone()));
} }
} }
} }