Made task releasing actually work.
This commit is contained in:
parent
c8edb195f4
commit
dae28a9db5
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user