Fixed initialization of static vars.
[platform/upstream/libzypp.git] / devel / genclass.in
index 2cf8229..0934bd3 100644 (file)
@@ -165,11 +165,10 @@ ${INDENT}{
 ${INDENT}public:
 ${INDENT}  /** Offer default Impl. */
 ${INDENT}  static shared_ptr<Impl> nullimpl()
-${INDENT}  { if ( ! _nullimpl ) _nullimpl.reset( new Impl ); return _nullimpl; }
-
-${INDENT}private:
-${INDENT}  /** Default Impl. */
-${INDENT}  static shared_ptr<Impl> _nullimpl;
+${INDENT}  {
+${INDENT}    static shared_ptr<Impl> _nullimpl( new Impl );
+${INDENT}    return _nullimpl;
+${INDENT}  }
 
 ${INDENT}private:
 ${INDENT}  friend Impl * rwcowClone<Impl>( const Impl * rhs );
@@ -179,10 +178,6 @@ ${INDENT}  { return new Impl( *this ); }
 ${INDENT}};
 ${INDENT}///////////////////////////////////////////////////////////////////
 
-${INDENT}shared_ptr<${CLASS}::Impl> ${CLASS}::Impl::_nullimpl;
-
-${INDENT}///////////////////////////////////////////////////////////////////
-
 ${INDENT}/** \relates ${CLASS}::Impl Stream output */
 ${INDENT}inline std::ostream & operator<<( std::ostream & str, const ${CLASS}::Impl & obj )
 ${INDENT}{