Hello!
When loading a level with World Partition enabled, we have a scenario where the `TSet` `ContainerOp.Registrations` has elements destructed while it is still accessed within `FWorldPartitionLoadingContext::FDeferred::~FDeferred()`. This seems to be caused by Blueprint compilation and subsequent Actor re-instancing happening during the destructor’s lifetime.
The sequence of events appears to be as follows (corresponding to the numbered entries in the callstack):
1. As the map finishes loading, the World Partition `FDeferred` object begins destruction.
2. During destruction, `AsyncLoading` is flushed.
3. Because Blueprints were compiled, the engine attempts to re-instance affected classes.
4. The old Actor instance is deleted.
5. This deletion triggers removal of the associated `ActorDescInstance`, which calls `Reset` on its `UniquePtr`.
6. Resetting the `UniquePtr` destructs the `FWorldPartitionActorDescInstance`, which is still present in the `ContainerOp.Registrations` set that `FDeferred::~FDeferred()` re-iterates after `FlushAsyncLoading` returns (steps 1 and 2).
The crash can be avoided by opening the BP it is crashing on first, which compiles it and the re-instancing finds nothing in memory to replace, then opening the level that is crashing on load. This is happening in our project and we honestly don’t know exactly what we did to cause it, so I haven’t tried to get a vanilla repro, though I can work on one if that is needed. The change that seemed to trigger it was the creation of a new Blueprint object that was then populated into the level, but I’m not seeing anything obviously wrong with that BP. The Construction Script is empty on it. I do notice that BP is always dirty when I open it, even after I resave it and restart the Editor. Regardless it seems like the callstack itself is problematic regardless of the cause of the compilation.
This issue is present in both 5.6.1 and 5.7.1 for us, and is only present in Editor. Cooked builds do not have this issue.
This seems to be similar to [Crash when opening world [Content removed] however instead of the Actor’s getting destroyed, it is the DescInfos.
Thanks!
[Attachment Removed]