Fixed critical bug causing tasks to leak when serially assigning multiple times to a TaskHandle. Removed extraneous de-optimization of WaitForAll awaiter.

This commit is contained in:
Tim Ambrogi 2022-05-19 10:15:20 -04:00
parent 79185006a8
commit 4ffc4b106d

View File

@ -225,7 +225,7 @@ public:
AddRef(); AddRef();
} }
Task(const Task& in_otherTask) /// Copy constructor (TaskHandle/WeakTaskHandle only) Task(const Task& in_otherTask) /// Copy constructor (TaskHandle/WeakTaskHandle only)
: Task(in_otherTask.GetInternalTask()) : m_taskInternal(in_otherTask.GetInternalTask())
{ {
static_assert(IsCopyable(), "Cannot copy-construct Task/WeakTask (only TaskHandle/WeakTaskHandle)"); static_assert(IsCopyable(), "Cannot copy-construct Task/WeakTask (only TaskHandle/WeakTaskHandle)");
AddRef(); AddRef();
@ -807,7 +807,6 @@ inline Task<> WaitForAny(TArray<TaskSingleEntry> in_entries)
} }
/// Awaiter task that manages a set of other awaiters and waits until all of them are done /// Awaiter task that manages a set of other awaiters and waits until all of them are done
COROUTINE_OPTIMIZE_OFF // NOTE: There is a compiler optimization bug in versions of Clang used on some platforms that cause it to crash when compiling this function
inline Task<> WaitForAll(TArray<TaskSingleEntry> in_entries) inline Task<> WaitForAll(TArray<TaskSingleEntry> in_entries)
{ {
TASK_NAME_ENTRIES_ALL(__FUNCTION__, in_entries); TASK_NAME_ENTRIES_ALL(__FUNCTION__, in_entries);
@ -834,7 +833,6 @@ inline Task<> WaitForAll(TArray<TaskSingleEntry> in_entries)
co_await Suspend(); co_await Suspend();
} }
} }
COROUTINE_OPTIMIZE_ON
/// Awaiter task that behaves like WaitForAny(), but returns a value associated with whichever awaiter finishes first /// Awaiter task that behaves like WaitForAny(), but returns a value associated with whichever awaiter finishes first
template<class tValue> template<class tValue>