There is a bug in vtkObjectFactory::UnRegisterAllFactories(); I'm using 
4.1.1, release 1.1246, the nightly files from 2002/06/14.
File Common/vtkObjectFactory.cxx, Line 427,
     libs[index] = factory->LibraryHandle;
should be
     libs[index++] = factory->LibraryHandle;
David