Fix crash when GPUTask gets deleted before sync happens
This commit is contained in:
@@ -58,6 +58,8 @@ protected:
|
||||
{
|
||||
}
|
||||
|
||||
~GPUTask();
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Gets a task type.
|
||||
|
||||
@@ -7,6 +7,16 @@
|
||||
#include "Engine/Core/Types/String.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
|
||||
GPUTask::~GPUTask()
|
||||
{
|
||||
// Ensure to dereference task
|
||||
if (auto context = _context)
|
||||
{
|
||||
_context = nullptr;
|
||||
context->OnCancelSync(this);
|
||||
}
|
||||
}
|
||||
|
||||
void GPUTask::Execute(GPUTasksContext* context)
|
||||
{
|
||||
ASSERT(IsQueued() && _context == nullptr);
|
||||
|
||||
Reference in New Issue
Block a user