fix: potential UAF in OnDownloadPathGenerated (#50010)

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-02 18:36:12 -05:00
committed by GitHub
parent 1a760a18e5
commit 0da6944cb6

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));