[Libreoffice-commits] .: sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Oct 15 05:17:51 PDT 2012
sc/source/ui/unoobj/viewuno.cxx | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
New commits:
commit 6d43804045e81e5ad6c08bba8a3d9dbb0d6e2f0f
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Oct 15 14:13:19 2012 +0200
ScTabViewObj: fix STL assertion:
ScTabViewObj methods that invoke listeners need to be prepared for the
listener removing itself in the notification call, which some chart code
does when inserting a chart, resulting in assertion:
error: attempt to increment a singular iterator.
Change-Id: I939afcc72d2b2040cd94113a0e159605d85ce592
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index c28ad1a..a8ef1ed 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -2121,7 +2121,10 @@ void ScTabViewObj::RangeSelDone( const String& rText )
aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
aEvent.RangeDescriptor = rtl::OUString( rText );
- BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, aRangeSelListeners)
+ // copy on the stack because listener could remove itself
+ XRangeSelectionListenerVector const listeners(aRangeSelListeners);
+
+ BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, listeners)
rListener->done( aEvent );
}
@@ -2131,7 +2134,10 @@ void ScTabViewObj::RangeSelAborted( const String& rText )
aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
aEvent.RangeDescriptor = rtl::OUString( rText );
- BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, aRangeSelListeners)
+ // copy on the stack because listener could remove itself
+ XRangeSelectionListenerVector const listeners(aRangeSelListeners);
+
+ BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, listeners)
rListener->aborted( aEvent );
}
@@ -2141,7 +2147,10 @@ void ScTabViewObj::RangeSelChanged( const String& rText )
aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
aEvent.RangeDescriptor = rtl::OUString( rText );
- BOOST_FOREACH(const XRangeSelectionChangeListenerUnoRef rListener, aRangeChgListeners)
+ // copy on the stack because listener could remove itself
+ XRangeSelectionChangeListenerVector const listener(aRangeChgListeners);
+
+ BOOST_FOREACH(const XRangeSelectionChangeListenerUnoRef rListener, listener)
rListener->descriptorChanged( aEvent );
}
More information about the Libreoffice-commits
mailing list