[vtkusers] Migration problem vtk 5.8 - vtk 6.1

Marcus D. Hanwell marcus.hanwell at kitware.com
Wed Jul 2 13:05:24 EDT 2014


Hi Lorenzo,

On Wed, Jul 2, 2014 at 8:05 AM, Lorenzo Cesario
<lorenzo.cesario at softeco.it> wrote:
> Hi Marcus,
> tks for your answer. Yes, I used the #pragma once directive inside my
> InitVtkObjFactory.h, so the file has the following code:
>
> #pragma once
>
> #include <vtkAutoInit.h>
> VTK_MODULE_INIT(vtkInteractionStyle);
> VTK_MODULE_INIT(vtkRenderingFreeType);
> VTK_MODULE_INIT(vtkRenderingFreeTypeOpenGL);
> VTK_MODULE_INIT(vtkRenderingOpenGL);
>
> Debugging the code, during the factories creation I can see that the
> RegisteredFactories object defined in the file vtkObjectFactory.cxx,
> contains all the 4 factories. Looking inside the items value of that object
> I can see in the debug tooltip that each one is the related "factory"
> object. So for the InteractionStyleObjectFactory I can see the class name
> and the "mother" class vtkObjectBase.
> Instead, during the exit of my appliation, when the UnRegisterAllFactories()
> method is called, I can't see anymore this value on the item related to the
> vtkInteractionStyleObjectFactory (I see only the vtkObjectBase), while for
> the remaining object factories I continue to see the class name.
> At last, I fixed this behaviour for the debug 64bit version of my
> application calling the static method
> vtkObjectFactory::UnRegisterAllFactories(); just before calling the
> FreeLibrary of my dll. In this way, when this method is called by the
> vtkClenaupObjectFactory, the RegisteredFactories is already NULL.
> It doesn't crash anymore in Debug 32/64 bit and Release 32 bit. It continues
> crashing in Release 64bit in the vtkCommonCore-6.1.dll.
> I don't think that this could be a solution, could be a bug in the
> vtkObjectFactory?
>
It certainly sounds odd, Visual Studio 2010 is pretty well tested. I
am not sure, but it sounds like an issue with the object factory or a
compiler issue. It is odd that you have a architecture/build specific
issue (32/64 bit on the same system) when calling it directly.

Sorry I can't be more help, I will see if I can reproduce this. I also
recently cleaned up a lot of the object factory code for
implementation modules a few weeks ago to ensure it is more consistent
across modules. Did you try a clean build (sounds like you probably
did with this level of experimentation).

Marcus


More information about the vtkusers mailing list