diff --git a/src/common/singletonsubclass.hpp b/src/common/singletonsubclass.hpp index 8877ba6bf..e779b820e 100644 --- a/src/common/singletonsubclass.hpp +++ b/src/common/singletonsubclass.hpp @@ -73,13 +73,20 @@ namespace cinelerra virtual S* create () { return POL::create (); } // covariance checked! virtual void destroy (I* pSi) { POL::destroy (static_cast (pSi)); } }; - + + + struct My_scoped_ptr : scoped_ptr ///< implementation detail: defeat static initialisation + { + using scoped_ptr::get; + My_scoped_ptr() : scoped_ptr (get()? get() : 0) {} ///< bypass if already configured + }; + /** we configure this link \i later, when the singleton factory * is actually created, to point at the desired implementation subclass. */ - static scoped_ptr link; + static My_scoped_ptr link; - /** Forwarding Template to configure the basic SingletonFactory */ + /** Forwarding Template used to configure the basic SingletonFactory */ template struct Adapted { @@ -89,7 +96,7 @@ namespace cinelerra }; template class A, class I> - scoped_ptr::Link> Adapter::link (0); + typename Adapter::My_scoped_ptr Adapter::link; // note: use special ctor (due to stati init order!) /** type-information used to configure the factory instance