Skip to content

BUG: Resolve crash by fixing vtkSMPToolsAPI static initialization order issue

This commit addresses a crash related to the static initialization order 'fiasco' in vtkSMPToolsAPI. It ensures proper deletion of the vtkSMPToolsAPI singleton once the last translation unit referencing it has been unloaded. This correction ensures that the SMP backend is cleaned up at the appropriate time, particularly in applications like 3D Slicer that make use of other singleton.

To avoid altering the public API of vtkSMPToolsAPI, it introduces the variable InstanceAsPointer, allowing instantiation on the heap (dynamically).

For more details, see https://github.com/Slicer/Slicer/issues/7449

Edited by Jean-Christophe Fillion-Robin

Merge request reports