diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-15 10:03:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-15 10:34:49 +0100 |
commit | 2b8cf734e3f70d96419119e2a21293c617b2e167 (patch) | |
tree | c691a6f11f7872c283607c2e98d609bf01712dfa /cppuhelper | |
parent | e355d2dc89963f26e5856be8b324d386e4c564f6 (diff) |
improve "convert OSL_ASSERT to assert"
this fixes commit 3a0c4574449fc2313306c4e0e39bb7416cc20657, by
converting the assert in removeInterface() to SAL_WARN_IF, and similarly
for the related addInterface() method
Comment from sberg on the original commit:
This leaves OInterfaceContainerHelper::add-/removeInterface in somewhat
inconsistent state (as addInterface OSL_ASSERTs non-null but then also
explicitly checks for null, i.e., effectively supports null).
css.lang.XComponent::add-/removeEventListener do not explicitly specify
whether or not their arg may be null. I /think/ we traditionally
supported null; asserting non-null thus might cause issues for 3rd-party
code.
Change-Id: I1e28cc03aa7dfe662125c573d60b447309009448
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86827
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/interfacecontainer.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx index eac0683329bb..a496b93fc372 100644 --- a/cppuhelper/source/interfacecontainer.cxx +++ b/cppuhelper/source/interfacecontainer.cxx @@ -23,6 +23,7 @@ #include <osl/diagnose.h> #include <osl/mutex.hxx> +#include <sal/log.hxx> #include <memory> @@ -190,7 +191,7 @@ void OInterfaceContainerHelper::copyAndResetInUse() sal_Int32 OInterfaceContainerHelper::addInterface( const Reference<XInterface> & rListener ) { - OSL_ASSERT( rListener.is() ); + SAL_WARN_IF( !rListener.is(), "cppuhelper", "rListener is empty" ); MutexGuard aGuard( rMutex ); if( bInUse ) copyAndResetInUse(); @@ -221,7 +222,7 @@ sal_Int32 OInterfaceContainerHelper::addInterface( const Reference<XInterface> & sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference<XInterface> & rListener ) { - assert( rListener.is() ); + SAL_WARN_IF( !rListener.is(), "cppuhelper", "rListener is empty" ); MutexGuard aGuard( rMutex ); if( bInUse ) copyAndResetInUse(); |