Hi Sascha,

seems like I found why the application crashed at startup (actually, 
only the first time after rebuild!).
What I had was probably an old and deprecated way of initializing the 
core object factory using a RegisterXXXCoreObjectFactory() and 
RegisterOneFactory() functions with a static flag to check if 
registration was already done.
Once I replaced the RegisterOneFactory() calls with having member 
variables in the CoreObjectFactory, the crash started happening every time.

Reason for that is that the module dll was loaded, then unloaded, and 
then loaded again. As the CoreObjectFactory was never unregistered on 
the module dll unload, this caused the crash.
So basically the solution was to create a static instance of a struct 
with constructor registering the factory and destructor unregistering it 
(similar to ConnectomicsObjectFactory).

I'm still interested why the module dll is loaded twice though - could 
you perhaps clarify this?

Thanks,
   Rostislav.

On 14/08/2014 15:26, Sascha Zelzer wrote:
> Hi,
>
> this should very well be possible. Both the old way of registration 
> and the activator approach happen during static initialization. A 
> stack trace of your crash could shed more light on your particular 
> problem.
>
> Best,
> Sascha
>
> On 08/13/2014 07:13 PM, Rostislav Khlebnikov wrote:
>> Hi guys,
>>
>> is it possible to register CoreObject-, Reader-, and Writer- factories
>> for datatypes introduced within a module using 
>> US_EXPORT_MODULE_ACTIVATOR?
>> I mean it actually works, but crashes on startup sometimes.
>>
>> Rostislav.
>>
>> ------------------------------------------------------------------------------
>>  
>>
>> _______________________________________________
>> mitk-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>


------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to