summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-09-09 12:12:28 +0200
committerMichael Stahl <mstahl@redhat.com>2017-09-15 16:54:53 +0200
commit14f22c32e1edc2c5c4a72f3e3621e1de57b26b57 (patch)
tree9632bab52dce8420a0a06c143af8532155054085
parentaaa6ceb9fa91f38d1c32cfe3882255cfd1490ab9 (diff)
tdf#112254: fix memory leak in optaboutconfig (cui)
Store UserData objects in a member defined as vector of unique_ptr so we're sure UserData objects will be destroyed when out of the scope Change-Id: Ib5494ad563272adcf64035300f3213688437fcfc Reviewed-on: https://gerrit.libreoffice.org/42123 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr> (cherry picked from commit 8e0352ecba4b7c72086f8b25d3f7fede8906a6d1) Reviewed-on: https://gerrit.libreoffice.org/42324 Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--cui/source/options/optaboutconfig.cxx6
-rw-r--r--cui/source/options/optaboutconfig.hxx2
2 files changed, 6 insertions, 2 deletions
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index ce4aa9d409b0..d4f6f813c916 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -210,7 +210,8 @@ void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUS
pEntry->AddItem(o3tl::make_unique<SvLBoxString>(rStatus));
pEntry->AddItem(o3tl::make_unique<SvLBoxString>(rType));
pEntry->AddItem(o3tl::make_unique<SvLBoxString>(rValue));
- pEntry->SetUserData( new UserData(rPropertyPath) );
+ m_vectorUserData.push_back(o3tl::make_unique<UserData>(rPropertyPath));
+ pEntry->SetUserData(m_vectorUserData.back().get());
if(bInsertToPrefBox)
m_pPrefBox->Insert( pEntry, pParentEntry );
@@ -291,7 +292,8 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
pEntry->AddItem(o3tl::make_unique<SvLBoxString>(""));
pEntry->AddItem(o3tl::make_unique<SvLBoxString>(""));
- pEntry->SetUserData( new UserData(xNextNameAccess, lineage + 1) );
+ m_vectorUserData.push_back(o3tl::make_unique<UserData>(xNextNameAccess, lineage + 1));
+ pEntry->SetUserData(m_vectorUserData.back().get());
pEntry->EnableChildrenOnDemand();
m_pPrefBox->Insert( pEntry, pParentEntry );
}
diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx
index b33be6505207..5efef99828e0 100644
--- a/cui/source/options/optaboutconfig.hxx
+++ b/cui/source/options/optaboutconfig.hxx
@@ -24,6 +24,7 @@ namespace svx { class OptHeaderTabListBox; }
class CuiAboutConfigTabPage;
class CuiAboutConfigValueDialog;
struct Prop_Impl;
+struct UserData;
class CuiCustomMultilineEdit : public Edit
{
@@ -46,6 +47,7 @@ private:
VclPtr<PushButton> m_pEditBtn;
VclPtr<PushButton> m_pSearchBtn;
VclPtr<Edit> m_pSearchEdit;
+ std::vector < std::unique_ptr<UserData> > m_vectorUserData;
SvTreeListEntries m_modifiedPrefBoxEntries;
std::vector< std::shared_ptr< Prop_Impl > > m_vectorOfModified;