sc/source/ui/undo/undobase.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 40ba3e617e351372c5ee1d735745f835fe2a90c4
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Tue Jul 9 15:47:24 2024 -0400
Commit:     Patrick Luby <guibomac...@gmail.com>
CommitDate: Wed Jul 10 13:57:55 2024 +0200

    tdf#161712 invoke ScSimpleUndo::EndUndo() before ShowBlock()
    
    If this is an instance of ScUndoAutoFill, ShowBlock() will invoke
    ScTabViewShell::MoveCursorAbs() which will delete this instance
    so invoke ScSimpleUndo::EndUndo() first.
    
    Change-Id: I7ef6dfa0444c38974e1d8c5af6672144f045d22d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170254
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit 99fda8da4e0a1b24c9aaecacfeeba0fe593fe730)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170288
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    Tested-by: Patrick Luby <guibomac...@gmail.com>

diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index c9a233604281..6b4bc3246c35 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -269,8 +269,12 @@ void ScBlockUndo::EndUndo()
     EnableDrawAdjust( &pDocShell->GetDocument(), true );
     DoSdrUndoAction( pDrawUndo.get(), &pDocShell->GetDocument() );
 
-    ShowBlock();
+    // tdf#161712 invoke ScSimpleUndo::EndUndo() before ShowBlock()
+    // If this is an instance of ScUndoAutoFill, ShowBlock() will invoke
+    // ScTabViewShell::MoveCursorAbs() which will delete this instance
+    // so invoke ScSimpleUndo::EndUndo() first.
     ScSimpleUndo::EndUndo();
+    ShowBlock();
 }
 
 void ScBlockUndo::EndRedo()

Reply via email to