sd/source/ui/view/sdwindow.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 6668b112b341edd24ca77ba88b834108d67b0602
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu May 6 16:04:17 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu May 6 18:27:23 2021 +0200

    Resolves: tdf#138855 crash on use of Outliner freed by GetFocus
    
    probably since...
    
    commit 3a662445a0e3666637e5eb140b106a1347f050eb
    Date:   Sun Jun 23 17:54:49 2019 -0800
    
        tdf#126061 Make text edit outliner view show cursor
    
        Change-Id: Ic4e8b5984d5b21c3b789eba943d35d4cad1ba867
        Reviewed-on: https://gerrit.libreoffice.org/74676
    
    Change-Id: Ibd6cf9e6f539e651d6e98f2af4a2eba55f081b58
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115184
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 7ab817969516..eceb4254a1fe 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -263,13 +263,16 @@ void Window::Command(const CommandEvent& rCEvt)
     if (rCEvt.GetCommand() == CommandEventId::ModKeyChange)
         vcl::Window::Command(rCEvt);
     //show the text edit outliner view cursor
-    else if (!HasFocus() && rCEvt.GetCommand() == CommandEventId::CursorPos)
+    else if (mpViewShell && !HasFocus() && rCEvt.GetCommand() == 
CommandEventId::CursorPos)
     {
-        OutlinerView* pOLV = mpViewShell ? 
mpViewShell->GetView()->GetTextEditOutlinerView() : nullptr;
-        if (pOLV && this == pOLV->GetWindow())
+        // tdf#138855 Getting Focus may destroy TextEditOutlinerView so Grab if
+        // text editing active, but fetch the TextEditOutlinerView post-grab
+        if (mpViewShell->GetView()->IsTextEdit())
         {
             GrabFocus();
-            pOLV->ShowCursor();
+            OutlinerView* pOLV = 
mpViewShell->GetView()->GetTextEditOutlinerView();
+            if (pOLV && this == pOLV->GetWindow())
+                pOLV->ShowCursor();
         }
     }
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to