diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-31 15:48:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-31 21:36:58 +0200 |
commit | 1abd712e337909fe6c10930b16998eed0f50ae17 (patch) | |
tree | cc8c98c621b8a6b4f633e62a28c6ca7701618cfc | |
parent | a8c4db643eb4c332f2e8f25b2fd8c84401a847ac (diff) |
fix leak in SwFieldDlg
Change-Id: Iedca9c7bab2973740bb8428b1cbf9cd852ebf69a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116482
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/source/ui/fldui/fldtdlg.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/inc/fldtdlg.hxx | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx index de2c1adc3935..70d69203af14 100644 --- a/sw/source/ui/fldui/fldtdlg.cxx +++ b/sw/source/ui/fldui/fldtdlg.cxx @@ -126,7 +126,7 @@ SfxItemSet* SwFieldDlg::CreateInputItemSet(const OString& rID) SwDocShell *const pDocSh(static_cast<SwDocShell*>(SfxObjectShell::Current())); if (rID == "docinfo" && pDocSh) // might not have a shell if the dialog is restored on startup { - SfxItemSet* pISet = new SfxItemSet( pDocSh->GetPool(), svl::Items<SID_DOCINFO, SID_DOCINFO>{} ); + mxInputItemSet = std::make_unique<SfxItemSet>( pDocSh->GetPool(), svl::Items<SID_DOCINFO, SID_DOCINFO>{} ); using namespace ::com::sun::star; uno::Reference<document::XDocumentPropertiesSupplier> xDPS( pDocSh->GetModel(), uno::UNO_QUERY_THROW); @@ -135,8 +135,8 @@ SfxItemSet* SwFieldDlg::CreateInputItemSet(const OString& rID) uno::Reference< beans::XPropertySet > xUDProps( xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); - pISet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(xUDProps) ) ); - return pISet; + mxInputItemSet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(xUDProps) ) ); + return mxInputItemSet.get(); } else return nullptr; diff --git a/sw/source/uibase/inc/fldtdlg.hxx b/sw/source/uibase/inc/fldtdlg.hxx index 8f690bb25f9e..f55e84e2c202 100644 --- a/sw/source/uibase/inc/fldtdlg.hxx +++ b/sw/source/uibase/inc/fldtdlg.hxx @@ -22,7 +22,7 @@ #include <sal/config.h> #include <string_view> - +#include <memory> #include <sfx2/tabdlg.hxx> class SfxBindings; @@ -37,6 +37,7 @@ class SwFieldDlg : public SfxTabDialogController bool m_bHtmlMode; bool m_bDataBaseMode; bool m_bClosing; + std::unique_ptr<SfxItemSet> mxInputItemSet; virtual SfxItemSet* CreateInputItemSet(const OString& rId) override; virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; |