The real issue here is the validity of payload. After your actor has been blown up, the node memory reserved for this behavior tree task is no longer valid and since the payload is obtained from the node memory, it is invalid too.
The quickest workaround for you will be to ensure that any A.I. being destroyed aborts all its behavior tree tasks prior to expiry. Aborting the Fly To task will instantly tell the manager to clean up the active pathfinding request so by the time its done the pawn(/payload) won't turn out to be a dud. Calling BTComponent->StopTree on your behavior tree may be sufficient; whatever approach you choose, just test to ensure Unreal is calling UBTTask_FlyTo::AbortTask before your pawn is destroyed.
A plugin-level fix is going to be involved at this stage. It will require removal of the void* generic payload used by the existing result delegates and replacement with a non-generic structure (containing weak pointers to the ownercomp and a copy of the ActiveInstanceIdx).This will ensure that payloads will always be received by value rather than by reference. I probably won't be getting around to this any time soon, so for those who are't able to code this fix, higher-level workarounds like the one above are suggested.
~~~
PS: OwnerComp is a TWeakObjectPtr (internally a struct, rather than an object pointer), so IsValid() / Get() / etc are guaranteed to be safe operations
The quickest workaround for you will be to ensure that any A.I. being destroyed aborts all its behavior tree tasks prior to expiry. Aborting the Fly To task will instantly tell the manager to clean up the active pathfinding request so by the time its done the pawn(/payload) won't turn out to be a dud. Calling BTComponent->StopTree on your behavior tree may be sufficient; whatever approach you choose, just test to ensure Unreal is calling UBTTask_FlyTo::AbortTask before your pawn is destroyed.
A plugin-level fix is going to be involved at this stage. It will require removal of the void* generic payload used by the existing result delegates and replacement with a non-generic structure (containing weak pointers to the ownercomp and a copy of the ActiveInstanceIdx).This will ensure that payloads will always be received by value rather than by reference. I probably won't be getting around to this any time soon, so for those who are't able to code this fix, higher-level workarounds like the one above are suggested.
~~~
PS: OwnerComp is a TWeakObjectPtr (internally a struct, rather than an object pointer), so IsValid() / Get() / etc are guaranteed to be safe operations

Comment