[Libreoffice-commits] core.git: svl/source
Tor Lillqvist
tml at collabora.com
Wed May 28 01:44:13 PDT 2014
svl/source/notify/lstner.cxx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit 72827968e606adcdf8c16e5381b887180975ae46
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed May 28 11:07:09 2014 +0300
Try to avoid "attempt to erase from container with a past-the-end iterator"
I saw such an error (and the resulting abort) in CppunitTest_sw_ooxmlexport,
and the helpful backtrace displayed (it was on Linux) indicated it was caused
by the erase() call in SfxListener::RemoveBroadcaster_Impl(). (Obviously this
was when building against the debugging C++ runtime, i.e. --enable-dbgutil.)
Unfortunately this seems to be one of those random error conditions that are
hard to reproduce. At least I could not. But this is hopefully an obvious
improvement.
Change-Id: I0f247cf8f9fd0c151aafa59c43a49c100c518f19
diff --git a/svl/source/notify/lstner.cxx b/svl/source/notify/lstner.cxx
index 606b9a6..562f42c 100644
--- a/svl/source/notify/lstner.cxx
+++ b/svl/source/notify/lstner.cxx
@@ -59,7 +59,9 @@ SfxListener::~SfxListener()
void SfxListener::RemoveBroadcaster_Impl( SfxBroadcaster& rBroadcaster )
{
- aBCs.erase( std::find( aBCs.begin(), aBCs.end(), &rBroadcaster ) );
+ SfxBroadcasterArr_Impl::iterator aIter = std::find( aBCs.begin(), aBCs.end(), &rBroadcaster );
+ if ( aIter != aBCs.end() )
+ aBCs.erase( aIter );
}
More information about the Libreoffice-commits
mailing list