sw/inc/frmfmt.hxx | 9 ++------- sw/source/core/layout/atrfrm.cxx | 23 +++++++++++------------ 2 files changed, 13 insertions(+), 19 deletions(-)
New commits: commit 6bf8d7bb5df3a29b6540e0ff057c667dad61d907 Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> Date: Sun Apr 23 03:21:19 2017 +0200 use a unique_ptr to track the SwFlyDrawContact Change-Id: I1b9058b41d1708efa4069e737c2247c6600403f5 Reviewed-on: https://gerrit.libreoffice.org/36897 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michael...@libreoffice.org> diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index c0da19b899a6..caad71fc14cd 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -186,18 +186,13 @@ class SW_DLLPUBLIC SwFlyFrameFormat: public SwFrameFormat so it can be used to move frames of non-resizable objects to align them correctly when they get borders (this is done in SwWrtShell::CalcAndGetScale) */ Point m_aLastFlyFramePrtRectPos; - SwFlyDrawContact* m_pContact; + std::unique_ptr<SwFlyDrawContact> m_pContact; SwFlyFrameFormat( const SwFlyFrameFormat &rCpy ) = delete; SwFlyFrameFormat &operator=( const SwFlyFrameFormat &rCpy ) = delete; protected: - SwFlyFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm, - SwFrameFormat *pDrvdFrame ) - : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_FLYFRMFMT ) - , m_pContact(nullptr) - {} - + SwFlyFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm, SwFrameFormat *pDrvdFrame ); public: virtual ~SwFlyFrameFormat() override; diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index c000dc0c8ea8..e8ae3f185a9d 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -78,6 +78,7 @@ #include <calbck.hxx> #include <pagedeschint.hxx> #include <drawdoc.hxx> +#include <dcontact.hxx> #ifndef NDEBUG #include <ndtxt.hxx> @@ -2835,6 +2836,13 @@ void SwFrameFormats::dumpAsXml(xmlTextWriterPtr pWriter, const char* pName) cons IMPL_FIXEDMEMPOOL_NEWDEL( SwFlyFrameFormat ) + + +SwFlyFrameFormat::SwFlyFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm, SwFrameFormat *pDrvdFrame ) + : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_FLYFRMFMT ) + , m_pContact(nullptr) +{} + SwFlyFrameFormat::~SwFlyFrameFormat() { SwIterator<SwFlyFrame,SwFormat> aIter( *this ); @@ -2852,23 +2860,14 @@ SwFlyFrameFormat::~SwFlyFrameFormat() SwFlyDrawContact* SwFlyFrameFormat::GetOrCreateContact() { IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess(); -#ifdef DBG_UTIL - SwFlyDrawContact* pContact = SwIterator<SwFlyDrawContact,SwFormat>( *this ).First(); - assert(pContact == m_pContact); -#endif if(!m_pContact) - m_pContact = new SwFlyDrawContact(this, rIDDMA.GetOrCreateDrawModel()); - return m_pContact; + m_pContact.reset(new SwFlyDrawContact(this, rIDDMA.GetOrCreateDrawModel())); + return m_pContact.get(); } void SwFlyFrameFormat::ClearContact() { -#ifdef DBG_UTIL - SwFlyDrawContact* pContact = SwIterator<SwFlyDrawContact,SwFormat>( *this ).First(); - assert(pContact == m_pContact); -#endif - delete m_pContact; - m_pContact = nullptr; + m_pContact.reset(nullptr); }; /// Creates the Frames if the format describes a paragraph-bound frame.
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits