# Segfault on VTK 9.0.0 when creating vtkTextActor

**URL:** https://discourse.vtk.org/t/segfault-on-vtk-9-0-0-when-creating-vtktextactor/3265
**Category:** Support
**Created:** [May 10, 2020, 1:12am UTC](https://discourse.vtk.org/t/segfault-on-vtk-9-0-0-when-creating-vtktextactor/3265 "2020-05-10T01:12:19Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![olympionex](https://discourse.vtk.org/user_avatar/discourse.vtk.org/olympionex/32/3697_2.png) [@olympionex](https://discourse.vtk.org/u/olympionex)
#### Post date: [May 10, 2020, 1:12am UTC](https://discourse.vtk.org/t/segfault-on-vtk-9-0-0-when-creating-vtktextactor/3265/1 "2020-05-10T01:12:19Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![olympionex](https://discourse.vtk.org/user_avatar/discourse.vtk.org/olympionex/32/3697_2.png) [@olympionex](https://discourse.vtk.org/u/olympionex)
#### Post date: [May 10, 2020, 2:19am UTC](https://discourse.vtk.org/t/segfault-on-vtk-9-0-0-when-creating-vtktextactor/3265/2 "2020-05-10T02:19:04Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![estan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/estan/32/460_2.png) [@estan](https://discourse.vtk.org/u/estan)
#### Post date: [May 10, 2020, 9:01am UTC](https://discourse.vtk.org/t/segfault-on-vtk-9-0-0-when-creating-vtktextactor/3265/3 "2020-05-10T09:01:29Z")

</div>

Hi @olympionex,

Do you have

```auto
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.

---

<div class="post-metadata">

### Author: ![estan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/estan/32/460_2.png) [@estan](https://discourse.vtk.org/u/estan)
#### Post date: [May 10, 2020, 9:05am UTC](https://discourse.vtk.org/t/segfault-on-vtk-9-0-0-when-creating-vtktextactor/3265/4 "2020-05-10T09:05:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![olympionex](https://discourse.vtk.org/user_avatar/discourse.vtk.org/olympionex/32/3697_2.png) [@olympionex](https://discourse.vtk.org/u/olympionex)
#### Post date: [May 12, 2020, 5:14am UTC](https://discourse.vtk.org/t/segfault-on-vtk-9-0-0-when-creating-vtktextactor/3265/5 "2020-05-12T05:14:35Z")

</div>

Thanks very much. I had not discovered that yet.
