diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-03-12 20:24:45 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-03-23 11:00:42 +0100 |
commit | 3a6c7271b19ac1c38459ea4680f55a4fda7e3248 (patch) | |
tree | 8fdc9ffbe9b3d6e1b7b4c2287ecc9047151603a2 | |
parent | hwpfilter: why isn't that path string null terminated (diff) | |
download | core-3a6c7271b19ac1c38459ea4680f55a4fda7e3248.tar.gz core-3a6c7271b19ac1c38459ea4680f55a4fda7e3248.zip |
tdf#147928 "undo" may delete the current SwAnnotationShell
Change-Id: I69fb7e65e28743aa73e943e02d5029654b5543cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131366
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
(cherry picked from commit 15fb24db540dc29883346d7e8e37d96e4fe8dfb1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131472
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/uibase/shells/annotsh.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index b05fedf7c5ae..4647656a0226 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -1505,8 +1505,12 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq) SwWrtShell &rSh = m_rView.GetWrtShell(); SwUndoId nUndoId(SwUndoId::EMPTY); - tools::Long aOldHeight = m_rView.GetPostItMgr()->HasActiveSidebarWin() - ? m_rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight() + // tdf#147929 get these before "undo" which may delete this SwAnnotationShell + SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr(); + SfxBindings& rBindings = m_rView.GetViewFrame()->GetBindings(); + + tools::Long aOldHeight = pPostItMgr->HasActiveSidebarWin() + ? pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight() : 0; sal_uInt16 nId = rReq.GetSlot(); @@ -1579,10 +1583,10 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq) } } - m_rView.GetViewFrame()->GetBindings().InvalidateAll(false); + rBindings.InvalidateAll(false); - if (m_rView.GetPostItMgr()->HasActiveSidebarWin()) - m_rView.GetPostItMgr()->GetActiveSidebarWin()->ResizeIfNecessary(aOldHeight,m_rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight()); + if (pPostItMgr->HasActiveSidebarWin()) + pPostItMgr->GetActiveSidebarWin()->ResizeIfNecessary(aOldHeight, pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight()); } void SwAnnotationShell::StateUndo(SfxItemSet &rSet) |