diff options
author | Tor Lillqvist <tml@collabora.com> | 2014-05-28 11:07:09 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2014-05-28 11:40:28 +0300 |
commit | 72827968e606adcdf8c16e5381b887180975ae46 (patch) | |
tree | 1c09643eeb558f533a60a643576ffa59e11ce9b5 /svl | |
parent | c3cea107354fecda6dedcd6b998343a2bd33d6f3 (diff) |
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
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/notify/lstner.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/svl/source/notify/lstner.cxx b/svl/source/notify/lstner.cxx index 606b9a609c10..562f42c3da60 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 ); } |