<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt"> <FONT size=3 face=Calibri>Hi
Marcus,</FONT></FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt">yes of course I tried a clean
build.</P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt">Anyway, I think that the
problem is that I could fix it (although not in all the
configurations/architecture) calling the <FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">vtkObjectFactory::UnRegisterAllFactories(); that it
should be done by “vtk itself”.</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas>My
application is a single-document MFC executable, that uses for the visualization
in its main CWnd another dll including vtk libraries. </FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT
style="face: consolas">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?</FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT
face=Consolas>Tks,</FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT
face=Consolas>Lorenzo</FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt"></FONT></FONT> </P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><SPAN
style="mso-fareast-language: it"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">-----Messaggio originale-----<BR>Da: Marcus D. Hanwell
[mailto:marcus.hanwell@kitware.com] <BR>Inviato: mercoledì 2 luglio 2014
19:05<BR>A: Lorenzo Cesario<BR>Cc: VTK Users<BR>Oggetto: Re: [vtkusers]
Migration problem vtk 5.8 - vtk 6.1</FONT></FONT></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt"></FONT></FONT> </P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">Hi Lorenzo,</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt"></FONT></FONT> </P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">On Wed, Jul 2, 2014 at 8:05 AM, Lorenzo Cesario
<</FONT></FONT><FONT style="FONT-SIZE: 10.5pt"><A
style='href: "mailto:lorenzo.cesario@softeco.it"'><SPAN
style="TEXT-DECORATION: ; COLOR: ; text-underline: none"><FONT
color=#000000><FONT style="TEXT-DECORATION: none"
face=Consolas>lorenzo.cesario@softeco.it</FONT></FONT></SPAN></A></FONT><FONT
face=Consolas><FONT style="FONT-SIZE: 10.5pt">> wrote:</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> Hi Marcus,</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> tks for your answer. Yes, I used the #pragma once
directive inside my </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> InitVtkObjFactory.h, so the file has the
following code:</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">></FONT><FONT
style="FONT-SIZE: 10.5pt"> </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> #pragma once</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">></FONT><FONT
style="FONT-SIZE: 10.5pt"> </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> #include <vtkAutoInit.h></FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">>
VTK_MODULE_INIT(vtkInteractionStyle);</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">>
VTK_MODULE_INIT(vtkRenderingFreeType);</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">>
VTK_MODULE_INIT(vtkRenderingFreeTypeOpenGL);</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">>
VTK_MODULE_INIT(vtkRenderingOpenGL);</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">></FONT><FONT
style="FONT-SIZE: 10.5pt"> </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> Debugging the code, during the factories creation
I can see that the </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> RegisteredFactories object defined in the file
vtkObjectFactory.cxx, </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> contains all the 4 factories. Looking inside the
items value of that </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> object I can see in the debug tooltip that each
one is the related "factory"</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> object. So for the InteractionStyleObjectFactory
I can see the class </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> name and the "mother" class
vtkObjectBase.</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> Instead, during the exit of my appliation, when
the </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> UnRegisterAllFactories() method is called, I
can't see anymore this </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> value on the item related to the
vtkInteractionStyleObjectFactory (I </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> see only the vtkObjectBase), while for the
remaining object factories I continue to see the class name.</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> At last, I fixed this behaviour for the debug
64bit version of my </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> application calling the static method
</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> vtkObjectFactory::UnRegisterAllFactories(); just
before calling the </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> FreeLibrary of my dll. In this way, when this
method is called by the </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> vtkClenaupObjectFactory, the RegisteredFactories
is already NULL.</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> It doesn't crash anymore in Debug 32/64 bit and
Release 32 bit. It </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> continues crashing in Release 64bit in the
vtkCommonCore-6.1.dll.</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> I don't think that this could be a solution,
could be a bug in the </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">> vtkObjectFactory?</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">></FONT><FONT
style="FONT-SIZE: 10.5pt"> </FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">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.</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt"></FONT></FONT> </P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">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).</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt"></FONT></FONT> </P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt">Marcus</FONT></FONT></P>
<P class=MsoPlainText style="MARGIN: 0cm 0cm 0pt"><FONT face=Consolas><FONT
style="FONT-SIZE: 10.5pt"></FONT></FONT> </P></DIV></DIV></BODY></HTML>