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/fmtfld.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/fmtfld.hxx')
-rw-r--r-- | sw/inc/fmtfld.hxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index cc4c365b1238..1b72d3e6b83c 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -44,7 +44,7 @@ class SW_DLLPUBLIC SwFormatField css::uno::WeakReference<css::text::XTextField> m_wXTextField; - SwField* mpField; + std::unique_ptr<SwField> mpField; SwTextField* mpTextField; // the TextAttribute protected: @@ -70,11 +70,11 @@ public: const SwField* GetField() const { - return mpField; + return mpField.get(); } SwField* GetField() { - return mpField; + return mpField.get(); } /** @@ -84,7 +84,7 @@ public: @attention The current field will be destroyed before setting the new field. */ - void SetField( SwField * pField ); + void SetField( std::unique_ptr<SwField> pField ); const SwTextField* GetTextField() const { |