sd/source/ui/annotations/annotationmanager.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 5ab48fd9b1a65579b2a63077cd3d2192b57af2a5
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Jun 16 21:27:34 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Jun 17 09:40:03 2024 +0200

    fix crash in "delete comments by author" in impress
    
    insert comment, click on it to expand it, click on menubutton and
    use "delete all comments by..."
    
    crash on use of invalid iterator as callback trashes the vector
    being iterated over
    
    Change-Id: Ia86de87207f706f35a023efa433c5e67b8bb436a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168970
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sd/source/ui/annotations/annotationmanager.cxx 
b/sd/source/ui/annotations/annotationmanager.cxx
index c4d10f78f00b..296a6f5a3ac2 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -697,7 +697,8 @@ void AnnotationManagerImpl::DeleteAnnotationsByAuthor( 
std::u16string_view sAuth
 
         if( pPage )
         {
-            for (auto const& xAnnotation : pPage->getAnnotations())
+            std::vector<rtl::Reference<sdr::annotation::Annotation>> 
aAnnotations(pPage->getAnnotations()); // intentionally copy
+            for (auto const& xAnnotation : aAnnotations)
             {
                 if( xAnnotation->getAuthor() == sAuthor )
                 {

Reply via email to