summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-05-30 12:24:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-05-30 16:00:35 +0200
commita6856795267509aaf0b4f59a9fb3a626411d1cb6 (patch)
tree1aec9b53493454e37b371ec9a5fa6b82be6016f5 /basic
parent5b676a480a68f2ad7ceb107147a2ab3363b4d22d (diff)
cid#1504574 Resource leak
make an owner for the PropertyMapEntries Change-Id: Ie915a8a312f2b24488566814ad67fdeef89b5941 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135123 Tested-by: Jenkins Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/propacc.cxx15
-rw-r--r--basic/source/inc/propacc.hxx3
2 files changed, 7 insertions, 11 deletions
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index 06bba39073d7..4c948c3038af 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -54,17 +54,10 @@ Reference< XPropertySetInfo > SbPropertyValues::getPropertySetInfo()
// create on demand?
if (!m_xInfo.is())
{
- uno::Sequence<beans::Property> props(m_aPropVals.size());
- for (size_t n = 0; n < m_aPropVals.size(); ++n)
- {
- Property &rProp = props.getArray()[n];
- const PropertyValue &rPropVal = m_aPropVals[n];
- rProp.Name = rPropVal.Name;
- rProp.Handle = rPropVal.Handle;
- rProp.Type = cppu::UnoType<void>::get();
- rProp.Attributes = 0;
- }
- m_xInfo.set(new ::comphelper::PropertySetInfo(props));
+ assert(m_aPropInfos.empty());
+ for (auto const& it : m_aPropVals)
+ m_aPropInfos.emplace_back(it.Name, it.Handle, cppu::UnoType<void>::get(), 0, 0);
+ m_xInfo.set(new ::comphelper::PropertySetInfo(m_aPropInfos));
}
return m_xInfo;
}
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
index 66dd26cefe63..bb2d13d50216 100644
--- a/basic/source/inc/propacc.hxx
+++ b/basic/source/inc/propacc.hxx
@@ -22,11 +22,13 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <comphelper/propertysetinfo.hxx>
#include <cppuhelper/implbase.hxx>
#include <vector>
typedef std::vector<css::beans::PropertyValue> SbPropertyValueArr_Impl;
+typedef std::vector<comphelper::PropertyMapEntry> SbPropertyInfoArr_Impl;
typedef ::cppu::WeakImplHelper< css::beans::XPropertySet,
css::beans::XPropertyAccess > SbPropertyValuesHelper;
@@ -35,6 +37,7 @@ typedef ::cppu::WeakImplHelper< css::beans::XPropertySet,
class SbPropertyValues final : public SbPropertyValuesHelper
{
SbPropertyValueArr_Impl m_aPropVals;
+ SbPropertyInfoArr_Impl m_aPropInfos;
css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;
private: