fix leak in oox import
Change-Id: I5ff21841480d11c4bfae3c34fd12a6fb32e250e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115823
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/sc/source/filter/inc/defnamesbuffer.hxx b/sc/source/filter/inc/defnamesbuffer.hxx
index b0b3b1e..03eec97 100644
--- a/sc/source/filter/inc/defnamesbuffer.hxx
+++ b/sc/source/filter/inc/defnamesbuffer.hxx
@@ -87,6 +87,7 @@ class DefinedName : public DefinedNameBase
{
public:
explicit DefinedName( const WorkbookHelper& rHelper );
virtual ~DefinedName() override;
/** Sets the attributes for this defined name from the passed attribute set. */
void importDefinedName( const AttributeList& rAttribs );
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx
index 5f1bc1c..a554ab9 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -333,6 +333,14 @@ bool DefinedName::getAbsoluteRange( ScRange& orRange ) const
return getFormulaParser().extractCellRange( orRange, aFTokenSeq );
}
DefinedName::~DefinedName()
{
// this kind of field is owned by us - see lcl_addNewByNameAndTokens
if (mpScRangeData && maModel.mbHidden &&
(mcBuiltinId == BIFF_DEFNAME_CRITERIA || mcBuiltinId == BIFF_DEFNAME_FILTERDATABASE))
delete mpScRangeData;
}
DefinedNamesBuffer::DefinedNamesBuffer( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper )