From 135c1d6d0acd7270237f0a2410507114e7c14129 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 19 Jul 2019 16:56:12 +0100 Subject: crashtesting: failures on swfootnoteframe_colunlock_heap_use_after_free.sample MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit undo forcepoint80 hackery and try a different solution Change-Id: I52b5f9b41074e122bd32e70967e198ce9f86aec7 Reviewed-on: https://gerrit.libreoffice.org/76072 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/source/core/inc/frame.hxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sw/source/core/inc/frame.hxx') diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index ab1047d0348f..6e0d653690c4 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -1237,8 +1237,19 @@ public: //Flag pFrame for SwFrameDeleteGuard lifetime that we shouldn't delete //it in e.g. SwSectionFrame::MergeNext etc because we will need it //again after the SwFrameDeleteGuard dtor - explicit SwFrameDeleteGuard(SwFrame* pFrame); - ~SwFrameDeleteGuard(); + explicit SwFrameDeleteGuard(SwFrame* pFrame) + : m_pForbidFrame((pFrame && !pFrame->IsDeleteForbidden()) ? + pFrame : nullptr) + { + if (m_pForbidFrame) + m_pForbidFrame->ForbidDelete(); + } + + ~SwFrameDeleteGuard() + { + if (m_pForbidFrame) + m_pForbidFrame->AllowDelete(); + } }; typedef long (SwFrame:: *SwFrameGet)() const; -- cgit