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
This commit is contained in:
parent
81884c36a3
commit
fa6e10ea6a
1 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue