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

New commits:
commit 99fda8da4e0a1b24c9aaecacfeeba0fe593fe730
Author:     Patrick Luby <[email protected]>
AuthorDate: Tue Jul 9 15:47:24 2024 -0400
Commit:     Patrick Luby <[email protected]>
CommitDate: Wed Jul 10 11:16:11 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 <[email protected]>
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index a99dec962d89..9bcd5349f67a 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