fmod / fmod-for-unreal

FMOD Studio integration with Unreal.
https://fmod.com/resources/documentation-unreal
MIT License
202 stars 84 forks source link

Fixed pointers not being initialized in FFMODAssetTable constructor which lead to crashes on random #65

Closed Ogniok closed 2 years ago

Ogniok commented 3 years ago

BankLookup and AssetLookup pointers were not initialized to nullptr in FFMODAssetTable constructor so they contain garbage until FFMODAssetTable::Load is called. They are not accessed by the integration before doing so, but if the loading takes long enough time (in our case because of a slow server cooking assets on the fly), garbage collection may run before the FFMODAssetTable::Load method gets called and the BankLookup and AssetLookup pointers reference nonexistent objects which leads to a crash.

This fix simply initializes the pointers in the constructor to nullptr so that if the FFMODAssetTable::AddReferencedObjects method gets called before the FFMODAssetTable::Load method the asset table will not reference anything.

dyanikoglu commented 3 years ago

I can confirm this fix is also needed for Unreal Engine 5 (ue5-main), otherwise fmod is crashing UAT cook process.

fmod-andrew commented 2 years ago

Thanks, this will be fixed in our next release.