Async Task crashes due to Acces violation

Hi there!

I followed this tutorial here: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums

And made Tasks that receive a Pointer to a HierarchicalInstancedStaticMeshComponent and a Pointer to a custom Actor Component and when the Task is executed and comes to this line:

// Task properties set through constructor
UHierarchicalInstancedStaticMeshComponent * HISM;
UDataComponent * Data;
// and in DoTask

it crashes with an “Access violation writing location” message.

I am checking both for != nullptr.

I’ve read that it could be caused by the fact that I’m not using virtual method stubs but I tried making GetLocation virtual and it didn’t fix it.

Any ideas?

I split the line up into this:

// DoTask
FVector location = Data->GetLocation(idx);
FTransform transform = FTransform(location);
HISM->AddInstance(transform); // <--- Access violation writing location

And it only crashes in the last line.

See my forum post for further info: