[vtkusers] Migration problem vtk 5.8 - vtk 6.1

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue Jul 1 13:52:41 EDT 2014


On Tue, Jul 1, 2014 at 4:52 AM,  <lorenzo.cesario at softeco.it> wrote:
> Hi,
> my application has an executable and some dlls. Among them, there is one dll that used vtk 5.8 and now I'm doing the migration to the vtk 6.1.
>  I'm using Visual Studio 2010 and my appliation is MFC-based.
>
> In the properties of the dll using vtk, I obviously included the "Additional Include Directories" and "Additional Library" for the vtk header files and .lib files.
> Moreover I added in the "Preprocessor definition" field of the C/C++ Property of the same dll, this value: vtkRenderingCore_INCLUDE="InitVtkObjFactory.h" and I added the file InitVtkObjFactory.h with this code:
>
> #include <vtkAutoInit.h>
> VTK_MODULE_INIT(vtkRenderingOpenGL);
> VTK_MODULE_INIT(vtkInteractionStyle);
> VTK_MODULE_INIT(vtkRenderingFreeType);
> VTK_MODULE_INIT(vtkRenderingFreeTypeOpenGL);
>
> When I close the application it crashes and in the call stack there is the last call on vtkCommonCore-6.1.dll.

I have never tested the code in a scenario like this, although nothing
jumps out as an issue. Do you have header guards around this init
header to ensure it is just called once? It should be safe to call
many times, but it is possible something odd is happening there.
>
> Then, I removed the line inside the file InitVtkObjFactory.h related to the InteractionStyle as follows:
>
> #include <vtkAutoInit.h>
> VTK_MODULE_INIT(vtkRenderingOpenGL);
> VTK_MODULE_INIT(vtkRenderingFreeType);
> VTK_MODULE_INIT(vtkRenderingFreeTypeOpenGL);
>
> and in this case, when the application starts, it shows a "warning" window from vtk in which is written:
>
> Warning: In ..\..\..\..\..\src\Vtk\Rendering\Core\vtkInteractorStyleSwitchBase.cxx, line 43
> vtkInteractorStyleSwitchBase (07EC7FB8): Warning: Link to vtkInteractionStyle for default style selection.

This is there to warn that no default interaction style will be used,
many old applications relied upon this being present and we wanted a
warning. It is just a warning, but it could be quite frustrating to
track down. It is unlikely to cause other side effects if you chose to
ignore it, but there is no way of silencing the warning.
>
> but when I close the application, this time it has no error or crashes. I'm using a vtkInteractorStyleTrackballCamera for my RenderWindow.

If you set a style then all will work as expected. This looks like a
bug in the factory destruction, but I have not seen this in my testing
(I have also not built any VTK-based applications without using
CMake).
>
> Any ideas? Is there anything wrong in the migration related to the new modules initialization?
>
It is odd that it would break on such a simple module, with only a
single override. If you select a style you do not need that override,
but it would be nice to figure out what is going wrong here. I am not
aware of similar issues, do you have any more information on how/why
it is crashing? Is the object factory NULL for example?

Thanks,

Marcus


More information about the vtkusers mailing list