[vtkusers] OpenGL2/vtkOpenGLTexture.cxx signal SIGSEGV, Segmentation fault

Jorge Perez josp.jorge at gmail.com
Mon Jan 25 06:00:18 EST 2016


Hello, I have an application which is reaching a SIGSEGV when opengl
backend is OpenGL2 (master branch). I have traced the error and it seems to
be related to this kind of warning:

Warning: Kitware/vtk.gitlab/Common/ExecutionModel/vtkAlgorithm.cxx, line
1421
vtkOpenGLTexture (0x17e1620): Attempt to get connection index 0 for input
port 0, which has 0 connections.

The warning appears with both OpenGL and OpenGL2 backends but with the
OpenGL2 a SIGSEGV is reached.

The SIGSEGV is because the member vtkOpenGLTexture::TextureObject is NULL
and it can be used in:


   - OpenGL2/vtkOpenGLPolyDataMapper

if (texture)
  {
  tNumComp =
   vtkOpenGLTexture::SafeDownCast(texture)->
      *GetTextureObject()->*GetComponents();
  }

   - OpenGL2/vtkOpenGL2Texture.cxx

void vtkOpenGLTexture::CopyTexImage(int x, int y, int width, int height)
{
  this->*TextureObject->*CopyFromFrameBuffer(x, y, x, y, width, height);
}

void vtkOpenGLTexture::PostRender(vtkRenderer *vtkNotUsed(ren))
{
  this->*TextureObject->*Deactivate();
}

I see that within there are some pice of code which test for TextureObject
and uses it if it is not NULL, but there are others which do not do the
test for NULL.

In order to have a quick fix I have initialized  the member TextureObject
to vtkTextureObject::New() instead of the value 0 (at the constructor
vtkOpenGLTexture::vtkOpenGLTexture). That solved the SIGSEGV for my
application but I'm not sure if this could be a the correct solution.

I can submit a merge request if the change make sense.

this->TextureObject = vtkTextureObject::New();

best regards,

Jorge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160125/caaa05f7/attachment.html>


More information about the vtkusers mailing list