diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-03-10 16:05:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-11 07:44:16 +0100 |
commit | 3d7103f18eb0a5eaf49c0acd72c7f6a3b98199ae (patch) | |
tree | 0c61e11ff88b66d66c99caf87d9ed4e5e09c2289 /cppuhelper | |
parent | 3646ab583736e6d5e2b3fb4d51857b4b6b777b45 (diff) |
cppu:OWeakObject zombie debugging
add some logic to catch re-animating objects early
Change-Id: I42b13eaddbc227d8b0a4e786e86ced8fbb406cae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112268
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/weak.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx index a11e52bbbb78..06c6ed178def 100644 --- a/cppuhelper/source/weak.cxx +++ b/cppuhelper/source/weak.cxx @@ -100,6 +100,10 @@ Any SAL_CALL OWeakConnectionPoint::queryInterface( const Type & rType ) // XInterface void SAL_CALL OWeakConnectionPoint::acquire() throw() { +#ifdef DBG_UTIL + // catch things early which have been deleted and then re-acquired + assert(m_aRefCount != -1); +#endif osl_atomic_increment( &m_aRefCount ); } @@ -107,7 +111,12 @@ void SAL_CALL OWeakConnectionPoint::acquire() throw() void SAL_CALL OWeakConnectionPoint::release() throw() { if (! osl_atomic_decrement( &m_aRefCount )) + { +#ifdef DBG_UTIL + m_aRefCount = -1; +#endif delete this; + } } void OWeakConnectionPoint::dispose() |