diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-05-31 15:59:03 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-01 15:21:54 +0100 |
commit | c532fd3e081f470b70c7e9306d7ce62641e7b510 (patch) | |
tree | 98387d133f10dd490f234676bdc99bf041577d95 /comphelper | |
parent | extend this to headless plugin as well (diff) | |
download | core-c532fd3e081f470b70c7e9306d7ce62641e7b510.tar.gz core-c532fd3e081f470b70c7e9306d7ce62641e7b510.zip |
make this a well-behaved singleton
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/namedvaluecollection.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx index be789592bbf1..6ed6cd1af22e 100644 --- a/comphelper/source/misc/namedvaluecollection.cxx +++ b/comphelper/source/misc/namedvaluecollection.cxx @@ -30,14 +30,13 @@ #include "precompiled_comphelper.hxx" #include <comphelper/namedvaluecollection.hxx> -/** === begin UNO includes === **/ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/beans/PropertyState.hpp> -/** === end UNO includes === **/ #include <rtl/ustrbuf.hxx> #include <rtl/strbuf.hxx> +#include <rtl/instance.hxx> #include <osl/diagnose.h> #include <boost/unordered_map.hpp> @@ -277,6 +276,11 @@ namespace comphelper return false; } + namespace + { + class theEmptyDefault : public rtl::Static<Any, theEmptyDefault> {}; + } + //-------------------------------------------------------------------- const Any& NamedValueCollection::impl_get( const ::rtl::OUString& _rValueName ) const { @@ -284,8 +288,7 @@ namespace comphelper if ( pos != m_pImpl->aValues.end() ) return pos->second; - static Any aEmptyDefault; - return aEmptyDefault; + return theEmptyDefault::get(); } //-------------------------------------------------------------------- |