diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-19 21:37:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-20 21:17:01 +0200 |
commit | ca11699dbb5c721d527d68e4b68b4eac0d1a7a74 (patch) | |
tree | 8e3c67ae6b881928af85da468a1dab7547e53772 /sd/source/ui | |
parent | d437650712ff05475e1f3e8b2b4dd8fc47b1d8aa (diff) |
coverity#1435678 Resource leak
Change-Id: I994508d0d88fa6727c49d568956887ca1d22ce7e
Reviewed-on: https://gerrit.libreoffice.org/54588
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/source/ui')
-rw-r--r-- | sd/source/ui/view/viewshe2.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index 6c1ad846131c..2b45314c419a 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -478,8 +478,13 @@ void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize, return; } - SdUndoGroup* pUndoGroup(new SdUndoGroup(GetDoc())); - pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEFORMAT)); + SdUndoGroup* pUndoGroup(nullptr); + SfxViewShell* pViewShell(GetViewShell()); + if (pViewShell) + { + pUndoGroup = new SdUndoGroup(GetDoc()); + pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEFORMAT)); + } Broadcast (ViewShellHint(ViewShellHint::HINT_PAGE_RESIZE_START)); // use Model-based method at SdDrawDocument @@ -503,9 +508,7 @@ void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize, } // handed over undo group to undo manager - SfxViewShell* pViewShell(GetViewShell()); - - if(nullptr != pViewShell) + if (pViewShell) { pViewShell->GetViewFrame()->GetObjectShell()->GetUndoManager()->AddUndoAction(pUndoGroup); } |