fix: potential UAF in OnDownloadPathGenerated (#50150)

fix: potential UAF in OnDownloadPathGenerated

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2026-03-09 22:02:49 -07:00
committed by GitHub
parent e17eef4d62
commit e6e8269352

View File

@@ -268,7 +268,7 @@ void ElectronDownloadManagerDelegate::OnDownloadPathGenerated(
gin_helper::Promise<gin_helper::Dictionary> dialog_promise(isolate);
auto dialog_callback = base::BindOnce(
&ElectronDownloadManagerDelegate::OnDownloadSaveDialogDone,
base::Unretained(this), download_guid, std::move(callback));
weak_ptr_factory_.GetWeakPtr(), download_guid, std::move(callback));
std::ignore = dialog_promise.Then(std::move(dialog_callback));
file_dialog::ShowSaveDialog(settings, std::move(dialog_promise));