sideeffects / HoudiniEngineForUnreal

Houdini Engine Plugin for Unreal Engine.
http://www.sidefx.com/unreal
Other
1.32k stars 370 forks source link

UHoudiniInput::GetAllObjectArrays() crashes on PS5 (Clang) #184

Open vc-smerritt opened 2 years ago

vc-smerritt commented 2 years ago

There's a bug in Clang when using std::initializer_list that causes an occasional crash when UHoudiniInput::GetAllObjectArrays() is called from within ForAllHoudiniInputObjectArrays during UHoudiniInput::BeginDestroy().

See this SO post for more info: https://stackoverflow.com/questions/55166289/stdinitializer-list-destructs-the-containing-objects-before-the-scope-end-in-c

The workaround was to change GetAllObjectArrays to return a temporarily constructed TArray:

TArray<TArray<UHoudiniInputObject*>*> AllObjectArrays;
AllObjectArrays.Add(&GeometryInputObjects);
AllObjectArrays.Add(&CurveInputObjects);
AllObjectArrays.Add(&WorldInputObjects);
AllObjectArrays.Add(&SkeletalInputObjects);
AllObjectArrays.Add(&LandscapeInputObjects);
AllObjectArrays.Add(&AssetInputObjects);
AllObjectArrays.Add(&GeometryCollectionInputObjects);

return AllObjectArrays;