Made task releasing actually work.

This commit is contained in:
Patrick 2023-02-05 14:30:16 +01:00
parent c8edb195f4
commit dae28a9db5
Signed by: mewin
GPG Key ID: CEDB412C39B5BC47
2 changed files with 12 additions and 1 deletions

View File

@ -263,6 +263,16 @@ public:
m_taskInternal = std::move(in_otherTask.m_taskInternal);
return *this;
}
template<typename tOtherRet, eTaskRef OtherRefType, eTaskResumable OtherResumable>
bool operator ==(const Task<tOtherRet, OtherRefType, OtherResumable>& in_otherTask) noexcept
{
return m_taskInternal == in_otherTask.m_taskInternal;
}
template<typename tOtherRet, eTaskRef OtherRefType, eTaskResumable OtherResumable>
bool operator !=(const Task<tOtherRet, OtherRefType, OtherResumable>& in_otherTask) noexcept
{
return m_taskInternal != in_otherTask.m_taskInternal;
}
~Task() /// Destructor
{
RemoveRef(); // Remove logical reference task
@ -274,7 +284,7 @@ public:
{
return m_taskInternal.get();
}
operator bool() const /// Conversion-to-bool that yields whether an underlying coroutine is set for the task
explicit operator bool() const /// Conversion-to-bool that yields whether an underlying coroutine is set for the task
{
return IsValid();
}

View File

@ -140,6 +140,7 @@ public:
{
auto itWeak = std::find(m_tasks.begin(), m_tasks.end(), in_task);
assert(itWeak != m_tasks.end());
*itWeak = nullptr; // otherwise the next line will kill the task (in destructor)
m_tasks.erase(itWeak);
auto itStrong = std::find(m_strongRefs.begin(), m_strongRefs.end(), in_task);