cesium-unreal icon indicating copy to clipboard operation
cesium-unreal copied to clipboard

Fix bad_any_cast errors by disabling RTTI when building cesium-native

Open kring opened this issue 1 year ago • 1 comments

Fixes #1380

We're seeing bad_any_cast exceptions when loading tilesets with metadata, in release builds, on every platform except Windows. The cause appears to be that cesium-native is compiled with runtime type information (RTTI) enabled, but Cesium for Unreal - as required by Unreal Engine itself - is compiled with RTTI disabled. Windows isn't fussed about this, but apparently it causes subtle problems on Linux/Android/Apple.

kring avatar Jul 02 '24 11:07 kring

This PR also includes a bug fix to the GetInteger64 metadata functions on non-Windows platforms. None of them were working because on 64-bit clang platforms (definitely Linux, pretty sure about the others):

  • std::int64_t is a typedef to signed long int.
  • Unreal's int64 is a typedef to signed long long.

Both are 64-bit and seemingly identical. But they're different types, so IsMetadataInteger<int64> evaluates to false. :upside_down_face:

So this PR makes sure we use int64_t instead of int64 when instantiating cesium-native's type traits templates.

kring avatar Jul 03 '24 01:07 kring

Thanks @kring !

j9liu avatar Jul 22 '24 20:07 j9liu