summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-05-06 16:04:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-05-06 18:27:23 +0200
commit6668b112b341edd24ca77ba88b834108d67b0602 (patch)
tree4a89ff5ad892935c0a0bfef03667fe0993b6767a /sd
parent47c0cea5aae8f1ac5c8d79fc09a30c8c5f14af64 (diff)
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 <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/view/sdwindow.cxx11
1 files changed, 7 insertions, 4 deletions
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();
}
}
}