summaryrefslogtreecommitdiff
path: root/sw/source/core/inc/frame.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/inc/frame.hxx')
-rw-r--r--sw/source/core/inc/frame.hxx15
1 files changed, 13 insertions, 2 deletions
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;