Fixed use-after-move in TaskLoop::addTaskImpl() and some minor compilation problems.

This commit is contained in:
Patrick 2025-07-10 02:16:29 +02:00
parent e6556c6f90
commit d0be5f7739
2 changed files with 3 additions and 2 deletions

View File

@ -779,7 +779,7 @@ void TaskHandle::cancel() const MIJIN_NOEXCEPT
} }
} }
Optional<std::source_location> TaskHandle::getLocation() const noexcept Optional<std::source_location> TaskHandle::getLocation() const MIJIN_NOEXCEPT
{ {
if (std::shared_ptr<TaskSharedState> state = state_.lock()) if (std::shared_ptr<TaskSharedState> state = state_.lock())
{ {
@ -825,7 +825,7 @@ FuturePtr<TResult> TaskLoop<TAllocator>::addTaskImpl(TaskBase<TResult, TAllocato
// add tasks to a seperate vector first as we might be running another task right now // add tasks to a seperate vector first as we might be running another task right now
TAllocator<WrappedTask<TaskBase<TResult, TAllocator>>> allocator(allocator_); TAllocator<WrappedTask<TaskBase<TResult, TAllocator>>> allocator(allocator_);
addStoredTask(StoredTask(wrapTask(std::move(allocator), std::move(task)), std::move(setFuture), std::move(future))); addStoredTask(StoredTask(wrapTask(std::move(allocator), std::move(task)), std::move(setFuture), future));
return future; return future;
} }

View File

@ -7,6 +7,7 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <charconv> #include <charconv>
#include <climits>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <iterator> #include <iterator>