USplineMeshComponent->DestroyComponent causes Fatal Error, and crashes editor

This is happening at different times, but it happens every time.

I am recreating the spline mesh on every tick. Eventually it takes the game down.

I am attaching: Diagnostics.txt and the *.dmp

The source code is here:

I haven’t tested it in built game.

I would appreciate any suggestions on how to eliminate this from happening. Thank you!

Attachments:
Everything zipped,
Diagnostics.txt

Setting name to none might have fixed it. I cannot crash it anymore.

auto path = NewObject<USplineComponent>(this, NAME_None); 

Will keep testing.

Hey mxnko-

Can you provide the callstack and the log files from the crash as well? If you’re able to reproduce the crash in a new project, can you provide the setup steps to help me investigate the crash locally? Additionally, depending on your needs it may be better to create a single component that you activate/deactivate as necessary rather than creating new components and destroying them on tick.

, I’ve gotten it to work without recycling components.
The key was to use

path->GetLocationAtDistanceAlongSpline(0, ESplineCoordinateSpace::Local)

As mesh start, and equivalent for end using GetSplineLength(), Even when theoretically location should be identical when set to correct vector. I think it was just a mismatch between local and world vector and component probably ignored the update as it fell outside of spline space. If ESplineCoordinateSpace is changed to ::World in above the old behavior comes back.

Either way, its now working, which eliminates the bug. I can probably recreate the crash, not sure how relevant it is, since its caused by incorrect engine usage on my part.

You can mark this as resolved. Thank you for your help!