cadop / dhart

A library for Navigation Graphs, Visibility, Raycasting and other features for Design Humans Analysis RoboTics (DHART).
https://cadop.github.io/dhart/
GNU General Public License v3.0
13 stars 7 forks source link

C API crashes when invalid mesh is used by a BVH or can't be cleaned up #21

Open cadop opened 2 years ago

cadop commented 2 years ago

Currently just experienced with Unity when creating a BVH with 0 vertices, the C API will crash when trying to use this invalid mesh for raycasting.

While this isn't a priority since it only happens when incorrectly setting the BVH, it would be nice to have a more graceful exit.

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at DHARTAPI.RayTracing.NativeMethods:DestroyRayTracer <0x00126>
      at DHARTAPI.RayTracing.NativeMethods:C_DestroyRayTracer <0x00072>
      at DHARTAPI.RayTracing.EmbreeBVH:ReleaseHandle <0x00072>
      at System.Runtime.InteropServices.SafeHandle:DangerousReleaseInternal <0x00670>
      at System.Runtime.InteropServices.SafeHandle:InternalFinalize <0x0009a>
      at System.Runtime.InteropServices.SafeHandle:Dispose <0x000e2>
      at System.Runtime.InteropServices.SafeHandle:Finalize <0x0006b>
      at DHARTAPI.NativeUtils.NativeObject:Finalize <0x00142>
      at System.Object:runtime_invoke_virtual_void__this__ <0x0018b>
=================================================================

and


0x00007FF88F7446DF (embree3) rtcReleaseScene
0x00007FF8A36CE273 (DHARTAPI) GetPathInfo
0x00007FF8A36C5573 (DHARTAPI) DestroyRayTracer
cadop commented 2 years ago

Crash also happens if a BVH or Graph is setup and isn't cleaned up.