diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-04 10:07:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-10 12:27:54 +0200 |
commit | 1a33947a91685808fd5f6d4903b6ae896686066d (patch) | |
tree | 2a9454c3df148a16c3d4b14c3cfd1c9e10916da3 /sw/inc/docufld.hxx | |
parent | b7e75f974962db49d29d2f5261dce4de5cd42d3e (diff) |
pass SwField around by std::unique_ptr
Fix leak in SwFieldPage::InsertField, where it interacts badly with
SwFieldMgr::UpdateCurField
The awkward
return std::unique_ptr<SwField>(pTmp.release());
code is because clang 3.8.0 doesn't seem able to do auto-upcast of
std::unique_ptr.
Change-Id: I05b748e9cda145fd972a01bfa343239df32368b9
Reviewed-on: https://gerrit.libreoffice.org/57197
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/inc/docufld.hxx')
-rw-r--r-- | sw/inc/docufld.hxx | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index 8afc0a1e425a..5a6545f712b6 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -157,7 +157,7 @@ public: sal_uInt16 const nMaxPage); virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; virtual OUString GetPar2() const override; virtual void SetPar2(const OUString& rStr) override; @@ -187,7 +187,7 @@ public: SwAuthorField(SwAuthorFieldType*, sal_uInt32 nFormat); virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; void SetExpansion(const OUString& rStr) { m_aContent = rStr; } @@ -213,7 +213,7 @@ public: SwFileNameField(SwFileNameFieldType*, sal_uInt32 nFormat); virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; void SetExpansion(const OUString& rStr) { m_aContent = rStr; } @@ -237,7 +237,7 @@ public: SwTemplNameField(SwTemplNameFieldType*, sal_uInt32 nFormat); virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; }; @@ -267,7 +267,7 @@ public: void ChangeExpansion( const SwFrame* pFrame ); virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; virtual sal_uInt16 GetSubType() const override; virtual void SetSubType(sal_uInt16 nSub) override; @@ -301,7 +301,7 @@ class SW_DLLPUBLIC SwHiddenTextField : public SwField bool m_bValid : 1; ///< Is DB-field evaluated? virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; public: SwHiddenTextField( SwHiddenTextFieldType*, @@ -362,7 +362,7 @@ public: SwHiddenParaField(SwHiddenParaFieldType*, const OUString& rCond); virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; void SetHidden(bool bHidden) { m_bIsHidden = bHidden; } bool IsHidden() const { return m_bIsHidden; } @@ -391,7 +391,7 @@ class SW_DLLPUBLIC SwMacroField : public SwField bool m_bIsScriptURL; virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; public: /// Direct input, delete old value. @@ -465,7 +465,7 @@ public: virtual ~SwPostItField() override; virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; const DateTime& GetDateTime() const { return m_aDateTime; } const Date GetDate() const { return Date(m_aDateTime.GetDate()); } @@ -511,7 +511,7 @@ class SW_DLLPUBLIC SwDocInfoField : public SwValueField OUString m_aName; virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; public: SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, sal_uInt32 nFormat=0); @@ -547,7 +547,7 @@ public: SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFormat); virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; virtual sal_uInt16 GetSubType() const override; virtual void SetSubType(sal_uInt16 nSub) override; @@ -581,7 +581,7 @@ public: SwRefPageSetField( SwRefPageSetFieldType*, short nOff, bool bOn ); virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; virtual OUString GetPar2() const override; virtual void SetPar2(const OUString& rStr) override; @@ -619,7 +619,7 @@ public: SwRefPageGetField( SwRefPageGetFieldType*, sal_uInt32 nFormat ); virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; void SetText( const OUString& rText ) { m_sText = rText; } @@ -650,7 +650,7 @@ public: const OUString& sText, const OUString& sHelp ); virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; /// Placeholder-Text virtual OUString GetPar1() const override; @@ -690,7 +690,7 @@ public: virtual OUString GetDescription() const override; virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; /// Type virtual OUString GetPar1() const override; @@ -725,7 +725,7 @@ public: SwCombinedCharField( SwCombinedCharFieldType*, const OUString& rChars ); virtual OUString Expand() const override; - virtual SwField* Copy() const override; + virtual std::unique_ptr<SwField> Copy() const override; /// Characters virtual OUString GetPar1() const override; |