[Libreoffice-commits] core.git: 2 commits - sd/source sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 31 19:37:34 UTC 2021
sd/source/filter/eppt/grouptable.hxx | 7 +++----
sd/source/filter/eppt/pptx-grouptable.cxx | 12 ++++++------
sw/source/ui/fldui/fldtdlg.cxx | 6 +++---
sw/source/uibase/inc/fldtdlg.hxx | 3 ++-
4 files changed, 14 insertions(+), 14 deletions(-)
New commits:
commit 1abd712e337909fe6c10930b16998eed0f50ae17
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon May 31 15:48:33 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon May 31 21:36:58 2021 +0200
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 at collabora.co.uk>
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;
commit a8c4db643eb4c332f2e8f25b2fd8c84401a847ac
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon May 31 15:26:13 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon May 31 21:36:40 2021 +0200
flatten vector
Change-Id: I7459bcc499d6734328b5be63a4bebd2102d52e0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116481
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sd/source/filter/eppt/grouptable.hxx b/sd/source/filter/eppt/grouptable.hxx
index 6d252ceb8f29..885f9574164e 100644
--- a/sd/source/filter/eppt/grouptable.hxx
+++ b/sd/source/filter/eppt/grouptable.hxx
@@ -49,15 +49,14 @@ class GroupTable
sal_uInt32 mnIndex;
sal_uInt32 mnGroupsClosed;
- std::vector<std::unique_ptr<GroupEntry>>
- mvGroupEntry;
+ std::vector<GroupEntry> mvGroupEntry;
public:
sal_uInt32 GetCurrentGroupIndex() const { return mnIndex; };
sal_Int32 GetCurrentGroupLevel() const { return mvGroupEntry.size() - 1; };
- css::uno::Reference< css::container::XIndexAccess > &
- GetCurrentGroupAccess() const { return mvGroupEntry.back()->mXIndexAccess; };
+ const css::uno::Reference< css::container::XIndexAccess > &
+ GetCurrentGroupAccess() const { return mvGroupEntry.back().mXIndexAccess; };
sal_uInt32 GetGroupsClosed();
void ResetGroupTable( sal_uInt32 nCount );
void ClearGroupTable();
diff --git a/sd/source/filter/eppt/pptx-grouptable.cxx b/sd/source/filter/eppt/pptx-grouptable.cxx
index 1f743df45911..bf91f2fb692e 100644
--- a/sd/source/filter/eppt/pptx-grouptable.cxx
+++ b/sd/source/filter/eppt/pptx-grouptable.cxx
@@ -37,10 +37,10 @@ bool GroupTable::EnterGroup( css::uno::Reference< css::container::XIndexAccess >
bool bRet = false;
if ( rXIndexAccessRef.is() )
{
- std::unique_ptr<GroupEntry> pNewGroup( new GroupEntry( rXIndexAccessRef ) );
- if ( pNewGroup->mnCount )
+ GroupEntry aNewGroup( rXIndexAccessRef );
+ if ( aNewGroup.mnCount )
{
- mvGroupEntry.push_back( std::move(pNewGroup) );
+ mvGroupEntry.push_back( std::move(aNewGroup) );
bRet = true;
}
}
@@ -62,16 +62,16 @@ void GroupTable::ClearGroupTable()
void GroupTable::ResetGroupTable( sal_uInt32 nCount )
{
ClearGroupTable();
- mvGroupEntry.push_back( std::unique_ptr<GroupEntry>(new GroupEntry( nCount )) );
+ mvGroupEntry.push_back( GroupEntry( nCount ) );
}
bool GroupTable::GetNextGroupEntry()
{
while ( !mvGroupEntry.empty() )
{
- mnIndex = mvGroupEntry.back()->mnCurrentPos++;
+ mnIndex = mvGroupEntry.back().mnCurrentPos++;
- if ( mvGroupEntry.back()->mnCount > mnIndex )
+ if ( mvGroupEntry.back().mnCount > mnIndex )
return true;
mvGroupEntry.pop_back();
More information about the Libreoffice-commits
mailing list