[Libreoffice-commits] core.git: svl/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Mon Dec 23 14:48:14 PST 2013
svl/source/notify/broadcast.cxx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit bf1812806056349fd32785e1fa7ba7595c8c66fa
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Dec 23 23:46:02 2013 +0100
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.
diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx
index 425a1e2..19abe38 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))
More information about the Libreoffice-commits
mailing list