[Libreoffice-commits] core.git: sd/source
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 7 04:29:51 UTC 2020
sd/source/ui/sidebar/DocumentHelper.cxx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit f52f86a3905fc099832187ad20fd29f0ab73b43f
Author: Jim Raykowski <raykowj at gmail.com>
AuthorDate: Thu Jul 16 13:25:47 2020 -0800
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Fri Aug 7 06:29:09 2020 +0200
tdf#134847 fix nullptr use crash
Grabbing focus back to the document when OLE object last had focus sets
focus to the frame containing the OLE object. sd::ViewShell is no good
in this case and crashes when undo manager tries to pass ViewShellId to
EnterListAction. Other areas in the code set ViewShellId(-1) and then
check if ViewShell is good before getting ViewShellId. This patch
follows these practices.
Change-Id: I89093686c4d98148ac032832711f80479366741d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99759
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj at gmail.com>
diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx
index 151cc510622e..08fab9f247d3 100644
--- a/sd/source/ui/sidebar/DocumentHelper.cxx
+++ b/sd/source/ui/sidebar/DocumentHelper.cxx
@@ -312,9 +312,12 @@ void DocumentHelper::AssignMasterPageToPageList (
if (aCleanedList.empty() )
return;
+ ViewShellId nViewShellId(-1);
+ if (sd::ViewShell* pViewShell = rTargetDocument.GetDocSh()->GetViewShell())
+ nViewShellId = pViewShell->GetViewShellBase().GetViewShellId();
SfxUndoManager* pUndoMgr = rTargetDocument.GetDocSh()->GetUndoManager();
if( pUndoMgr )
- pUndoMgr->EnterListAction(SdResId(STR_UNDO_SET_PRESLAYOUT), OUString(), 0, rTargetDocument.GetDocSh()->GetViewShell()->GetViewShellBase().GetViewShellId());
+ pUndoMgr->EnterListAction(SdResId(STR_UNDO_SET_PRESLAYOUT), OUString(), 0, nViewShellId);
SdPage* pMasterPageInDocument = ProvideMasterPage(rTargetDocument,pMasterPage,rpPageList);
if (pMasterPageInDocument == nullptr)
More information about the Libreoffice-commits
mailing list