Skip to content

Commit

Permalink
BUG: Internal factory must use RegisterFactoryInternal method
Browse files Browse the repository at this point in the history
If just RegisterFactory is called to register an internal factory,
this will cause the dynamic libraries to be loaded during static
initialization. This is undesired behavior and may cause a race
condition of shared libraries loading other shared libraries.

Additionally, applications have been setting ITK_AUTOLOAD path during
executing, before any object were created or other objects
registered. This patch restores the behavior of the dynamic libraries
being loaded with this usage.

Change-Id: I88433ba6e0bcc1885c5e11a54307d0e6c481f85e
  • Loading branch information
blowekamp committed Nov 11, 2012
1 parent fb306df commit 39b4ab3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class HDF5TransformIOFactory:public ObjectFactoryBase
{
HDF5TransformIOFactory::Pointer metaFactory = HDF5TransformIOFactory::New();

ObjectFactoryBase::RegisterFactory(metaFactory);
ObjectFactoryBase::RegisterFactoryInternal(metaFactory);
}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ITK_EXPORT TxtTransformIOFactory:public ObjectFactoryBase
{
TxtTransformIOFactory::Pointer metaFactory = TxtTransformIOFactory::New();

ObjectFactoryBase::RegisterFactory(metaFactory);
ObjectFactoryBase::RegisterFactoryInternal(metaFactory);
}

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ITK_EXPORT MatlabTransformIOFactory:public ObjectFactoryBase
MatlabTransformIOFactory::Pointer metaFactory =
MatlabTransformIOFactory::New();

ObjectFactoryBase::RegisterFactory(metaFactory);
ObjectFactoryBase::RegisterFactoryInternal(metaFactory);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion Modules/Nonunit/Review/include/itkMRCImageIOFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ITK_EXPORT MRCImageIOFactory:public ObjectFactoryBase
{
MRCImageIOFactory::Pointer vtkFactory = MRCImageIOFactory::New();

ObjectFactoryBase::RegisterFactory(vtkFactory);
ObjectFactoryBase::RegisterFactoryInternal(vtkFactory);
}

protected:
Expand Down

0 comments on commit 39b4ab3

Please sign in to comment.