diff options
author | Eike Rathke <erack@redhat.com> | 2022-06-16 21:44:40 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2022-06-16 22:39:38 +0200 |
commit | 7a0a0e23b7e81c1ee0601824a4ee990a2178f98b (patch) | |
tree | 872961a23bc23c991a47754e6508abf87e3f3e1e | |
parent | e247d62ea65f269d8ec304e08d21796a1cc52c52 (diff) |
Resolves: tdf#147822 ScUnoListenerEntry container must be std::list
... instead of std::vector to not get invalidated iterators when
the container is resized.
Regression from
commit f8defe59ff75df2b516ee407f1dac22b0ac72a19
CommitDate: Wed Sep 6 22:45:10 2017 +0200
Replace some lists by vectors in unoobj (sc)
which was bad for this case.
Change-Id: I8d3a001242865cadc82b359a3198906d26373a41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136007
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
-rw-r--r-- | sc/inc/listenercalls.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/listenercalls.cxx | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sc/inc/listenercalls.hxx b/sc/inc/listenercalls.hxx index ff835a048b1a..acb009937fa1 100644 --- a/sc/inc/listenercalls.hxx +++ b/sc/inc/listenercalls.hxx @@ -19,7 +19,7 @@ #pragma once -#include <vector> +#include <list> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/lang/EventObject.hpp> @@ -48,7 +48,9 @@ struct ScUnoListenerEntry class ScUnoListenerCalls { private: - ::std::vector<ScUnoListenerEntry> aEntries; + // Must be list, not vector, to not invalidate iterators, see + // ExecuteAndClear() implementation. + ::std::list<ScUnoListenerEntry> aEntries; public: ScUnoListenerCalls(); diff --git a/sc/source/ui/unoobj/listenercalls.cxx b/sc/source/ui/unoobj/listenercalls.cxx index 2d9a23083ca8..7ff7c7df0956 100644 --- a/sc/source/ui/unoobj/listenercalls.cxx +++ b/sc/source/ui/unoobj/listenercalls.cxx @@ -44,7 +44,7 @@ void ScUnoListenerCalls::ExecuteAndClear() // During each modified() call, Add may be called again. // These new calls are executed here, too. - std::vector<ScUnoListenerEntry>::iterator aItr(aEntries.begin()); + std::list<ScUnoListenerEntry>::iterator aItr(aEntries.begin()); while (aItr != aEntries.end()) { ScUnoListenerEntry aEntry = *aItr; |