Hello, is the following FNonAbandonableTask implementation correct?
class AsyncTracer : public FNonAbandonableTask
{
public:
UAxisSearcher* SearcherCaller;
public:
AsyncTracer(UAxisSearcher* InSearcher);
~AsyncTracer();
FORCEINLINE TStatId GetStatId() const { RETURN_QUICK_DECLARE_CYCLE_STAT(AsyncTracer, STATGROUP_ThreadPoolAsyncTasks); }
void DoWork();
};
AsyncTracer::AsyncTracer(UAxisSearcher* InSearcher)
:SearcherCaller(InSearcher)
{
}
AsyncTracer::~AsyncTracer()
{
}
void AsyncTracer::DoWork()
{
...
if (IsValid(SearcherCaller)) /*<- This validity check does not prevent the crash!*/
{
UE_LOG(LogTemp, Log, TEXT("About to call begin path finds on: %s"), *SearcherCaller->GetName()); /*<-This log is NEVER printed when the crash occurs!*/
AsyncTask(ENamedThreads::GameThread, [=]() { SearcherCaller->BeginPathFinds(bAnyPointValid); } );
}
}