diff options
author | Noel Grandin <noel@peralex.com> | 2014-09-30 16:13:47 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-10-02 13:00:08 +0200 |
commit | d8be5a55760b01efa32708411c6e47fe74600edc (patch) | |
tree | 6edf19752904f90dd348d3cbb9a16d6391b58b60 /include/com | |
parent | 18ceb207ddd8e9065a8e0bd4a64163a3a2a0a0ce (diff) |
optimise UNO Sequence destructor
to avoid expensive function calls until the refcount reaches 0
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, slightly changing it to
add a uno_type_sequence_destroy to uno/sequence2.h instead of a
uno_type_destructSequence to uno/data.h.
Change-Id: I3bbff3294f2b515fc3c68c4c6c1cb16829f5cc44
Diffstat (limited to 'include/com')
-rw-r--r-- | include/com/sun/star/uno/Sequence.hxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/com/sun/star/uno/Sequence.hxx b/include/com/sun/star/uno/Sequence.hxx index ba3b8c123322..1ee59aebac45 100644 --- a/include/com/sun/star/uno/Sequence.hxx +++ b/include/com/sun/star/uno/Sequence.hxx @@ -95,9 +95,12 @@ inline Sequence< E >::Sequence( sal_Int32 len ) template< class E > inline Sequence< E >::~Sequence() { - const Type & rType = ::cppu::getTypeFavourUnsigned( this ); - ::uno_type_destructData( - this, rType.getTypeLibType(), (uno_ReleaseFunc)cpp_release ); + if (osl_atomic_decrement( &_pSequence->nRefCount ) == 0) + { + const Type & rType = ::cppu::getTypeFavourUnsigned( this ); + uno_type_sequence_destroy( + _pSequence, rType.getTypeLibType(), (uno_ReleaseFunc)cpp_release ); + } } template< class E > |