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

New commits:
commit 87e01af5c3a2e87892e9108a1ce8f511af2682d9
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Jun 16 21:27:34 2024 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Jun 17 12:11:29 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/+/168971
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins

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

Reply via email to