crashkonijn / GOAP

A multi-threaded GOAP system for Unity
Apache License 2.0
1.15k stars 127 forks source link

v3 Bug: Sometimes ResolveHandle is disposed incorrectly #223

Open crashkonijn opened 2 months ago

crashkonijn commented 2 months ago

Describe the bug

ObjectDisposedException: The Unity.Collections.NativeList1[CrashKonijn.Goap.Resolver.NodeData] has been deallocated, it is not allowed to access it
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckGetSecondaryDataPointerAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <e509afeff7384f24a8f0ac30527ff01c>:0)
Unity.Collections.NativeList1[T].AsArray () (at ./Library/PackageCache/com.unity.collections@1.4.0/Unity.Collections/NativeList.cs:607)
Unity.Collections.NativeList`1[T].GetEnumerator () (at ./Library/PackageCache/com.unity.collections@1.4.0/Unity.Collections/NativeList.cs:743)
CrashKonijn.Goap.Resolver.ResolveHandle.Complete () (at ./Library/PackageCache/com.crashkonijn.goap@2ba1c6ba2e/Runtime/CrashKonijn.Goap.Resolver/ResolveHandle.cs:63)
CrashKonijn.Goap.Runtime.AgentTypeJobRunner.Dispose () (at ./Library/PackageCache/com.crashkonijn.goap@2ba1c6ba2e/Runtime/CrashKonijn.Goap.Runtime/Classes/Runners/AgentTypeJobRunner.cs:206)
CrashKonijn.Goap.Runtime.Goap.Dispose () (at ./Library/PackageCache/com.crashkonijn.goap@2ba1c6ba2e/Runtime/CrashKonijn.Goap.Runtime/Classes/Runners/Goap.cs:53)
CrashKonijn.Goap.Runtime.GoapBehaviour.OnDestroy () (at ./Library/PackageCache/com.crashkonijn.goap@2ba1c6ba2e/Runtime/CrashKonijn.Goap.Runtime/Behaviours/GoapBehaviour.cs:45)