summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-10-15 14:13:19 +0200
committerMichael Stahl <mstahl@redhat.com>2012-10-15 14:15:41 +0200
commit6d43804045e81e5ad6c08bba8a3d9dbb0d6e2f0f (patch)
tree5e24cd517fe51498bfee4da7f676f3e1a4e12e7b /sc
parent962eeb3e5581006112835eaed6ef9a7a9f09bd62 (diff)
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
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index c28ad1a13bd3..a8ef1eda642b 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 );
}