1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00

Don't use 'callback' object that we may have moved out of

(cherry picked from commit fa6e10ea6a)
This commit is contained in:
Eelco Dolstra 2025-05-23 23:33:59 +02:00 committed by Mergify
parent c4813b8cbc
commit acc3cd460d

View file

@ -176,13 +176,13 @@ protected:
void getFile(const std::string & path,
Callback<std::optional<std::string>> callback) noexcept override
{
auto callbackPtr = std::make_shared<decltype(callback)>(std::move(callback));
try {
checkEnabled();
auto request(makeRequest(path));
auto callbackPtr = std::make_shared<decltype(callback)>(std::move(callback));
getFileTransfer()->enqueueFileTransfer(request,
{[callbackPtr, this](std::future<FileTransferResult> result) {
try {
@ -198,7 +198,7 @@ protected:
}});
} catch (...) {
callback.rethrow();
callbackPtr->rethrow();
return;
}
}