summaryrefslogtreecommitdiffstats
path: root/svl
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-12-23 23:46:02 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-12-23 23:46:02 +0100
commitbf1812806056349fd32785e1fa7ba7595c8c66fa (patch)
tree48a98c19d47171335070d081eb30171b8dc1ceb6 /svl
parentImprove native-code generator for (not only) Android. (diff)
downloadcore-bf1812806056349fd32785e1fa7ba7595c8c66fa.tar.gz
core-bf1812806056349fd32785e1fa7ba7595c8c66fa.zip
fix crash when erasing entry while iterating through vector
Broadcast might result in calling Remove on the same object which erases the entry from the listeners vector. If we create a copy we can still iterate through the vector as all iterators are still valid.
Diffstat (limited to 'svl')
-rw-r--r--svl/source/notify/broadcast.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx
index 425a1e2568cf..19abe3878684 100644
--- a/svl/source/notify/broadcast.cxx
+++ b/svl/source/notify/broadcast.cxx
@@ -124,7 +124,8 @@ void SvtBroadcaster::Broadcast( const SfxHint &rHint )
Normalize();
ListenersType::iterator dest(maDestructedListeners.begin());
- for (ListenersType::iterator it(maListeners.begin()); it != maListeners.end(); ++it)
+ ListenersType aListeners(maListeners); // this copy is important to avoid erasing entries while iterating
+ for (ListenersType::iterator it(aListeners.begin()); it != aListeners.end(); ++it)
{
// skip the destructed ones
while (dest != maDestructedListeners.end() && (*dest < *it))