Segfault on VTK 9.0.0 when creating vtkTextActor

On line 78 of vtkTextActor.cxx, the call to vtkTexture::New() returns a nullptr seemingly because it can’t find a factory to create that type and then I get a segfault when the next line tries to deference that pointer. Is there something special that I need to do in order to be able to instantiate vtkTextureObjects. I haven’t had this problem in older versions of VTK.

I ended up having to manually add:
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkRenderingFreeType);

My understanding is that this should be taken care of by cmake?

Hi @olympionex,

Do you have

find_package(VTK ... REQUIRED
    COMPONENTS
        RenderingOpenGL2
        RenderingFreeType
        ...
)
...
vtk_module_autoinit(
    TARGETS
         <YOUR_TARGET_NAME>
         ...
    MODULES
        VTK::RenderingOpenGL2
        VTK::RenderingFreeType
        ...
)
...
target_link_libraries(<YOUR_TARGET_NAME>
    PUBLIC
        VTK::RenderingOpenGL2
        VTK::RenderingFreeType
        ...
)

in your CMakeLists.txt?

If so, then I think it should be taken care of automatically like you say.

The major new thing here compared to VTK 8 is the vtk_module_autoinit(...).

Thanks very much. I had not discovered that yet.