[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sd/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu May 6 17:31:22 UTC 2021


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

New commits:
commit d253c0fdd548165adc1f19cadea01a24e73cfff3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu May 6 16:04:17 2021 +0100
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Thu May 6 19:30:50 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/+/115196
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.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();
         }
     }
 }


More information about the Libreoffice-commits mailing list