[vtkusers] R: Migration problem vtk 5.8 - vtk 6.1

Lorenzo Cesario lorenzo.cesario at softeco.it
Thu Jul 3 07:40:56 EDT 2014


 Hi Marcus,

yes of course I tried a clean build.

Anyway, I think that the problem is that I could fix it (although not in all the configurations/architecture) calling the vtkObjectFactory::UnRegisterAllFactories(); that it should be done by “vtk itself”.

My application is a single-document MFC executable, that uses for the visualization in its main CWnd another dll including vtk libraries. 

As I think it isn’t correct to call that method, could be a bug in vtk? or in any properties of my visual studio projects?

Tks,

Lorenzo



-----Messaggio originale-----
Da: Marcus D. Hanwell [mailto:marcus.hanwell at kitware.com] 
Inviato: mercoledì 2 luglio 2014 19:05
A: Lorenzo Cesario
Cc: VTK Users
Oggetto: Re: [vtkusers] Migration problem vtk 5.8 - vtk 6.1



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


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


More information about the vtkusers mailing list