sc/inc/listenercalls.hxx              |    6 ++++--
 sc/source/ui/unoobj/listenercalls.cxx |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 0750bc969ac515fb9390f02ddcaa022c846f2d8a
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Thu Jun 16 21:44:40 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Jun 17 09:22:39 2022 +0200

    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 <er...@redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 7a0a0e23b7e81c1ee0601824a4ee990a2178f98b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136023
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

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;

Reply via email to