mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Don't use 'callback' object that we may have moved out of
(cherry picked from commit fa6e10ea6a
)
This commit is contained in:
parent
c4813b8cbc
commit
acc3cd460d
1 changed files with 3 additions and 3 deletions
|
@ -176,13 +176,13 @@ protected:
|
||||||
void getFile(const std::string & path,
|
void getFile(const std::string & path,
|
||||||
Callback<std::optional<std::string>> callback) noexcept override
|
Callback<std::optional<std::string>> callback) noexcept override
|
||||||
{
|
{
|
||||||
|
auto callbackPtr = std::make_shared<decltype(callback)>(std::move(callback));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
checkEnabled();
|
checkEnabled();
|
||||||
|
|
||||||
auto request(makeRequest(path));
|
auto request(makeRequest(path));
|
||||||
|
|
||||||
auto callbackPtr = std::make_shared<decltype(callback)>(std::move(callback));
|
|
||||||
|
|
||||||
getFileTransfer()->enqueueFileTransfer(request,
|
getFileTransfer()->enqueueFileTransfer(request,
|
||||||
{[callbackPtr, this](std::future<FileTransferResult> result) {
|
{[callbackPtr, this](std::future<FileTransferResult> result) {
|
||||||
try {
|
try {
|
||||||
|
@ -198,7 +198,7 @@ protected:
|
||||||
}});
|
}});
|
||||||
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
callback.rethrow();
|
callbackPtr->rethrow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue