diff options
author | Matt K <mattkse@gmail.com> | 2023-11-26 19:01:20 -0600 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-11-28 06:16:54 +0100 |
commit | 61308112435628177b7884ab833ece843d37cd28 (patch) | |
tree | f98088d931bfada8a948a15469594e4b62073be7 /comphelper | |
parent | 9e876c164a1d9e552c08be3112ada09712a20eb3 (diff) |
tdf#156648 Prevent LO from adding an empty event listener
The problem is that an empty interface listener can be
added in Basic, which then crashes when trying to fire
an event on that listener. The fix is to check for
the existence of the listener before adding to the list
of listeners.
Change-Id: I3205ec1e6cdad431f6297f2b7833295b9eb64b8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159978
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/container/interfacecontainer2.cxx | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/comphelper/source/container/interfacecontainer2.cxx b/comphelper/source/container/interfacecontainer2.cxx index 9acff0a7f761..df1c9e0e69e9 100644 --- a/comphelper/source/container/interfacecontainer2.cxx +++ b/comphelper/source/container/interfacecontainer2.cxx @@ -172,6 +172,9 @@ void OInterfaceContainerHelper2::copyAndResetInUse() sal_Int32 OInterfaceContainerHelper2::addInterface( const Reference<XInterface> & rListener ) { OSL_ASSERT( rListener.is() ); + if ( !rListener.is() ) + return 0; + MutexGuard aGuard( rMutex ); if( bInUse ) copyAndResetInUse(); |