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@ubuntu.com>
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 7ab8179..eceb425 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();
}
}
}