summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-12-02 20:33:38 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2017-12-03 09:21:26 +0100
commit8c89cfe3cdf6595d5f3bb87ecc45b9f450195aac (patch)
tree4503d81a74b1f6e00134fbbbce4a228a45ca7b03
parentcc1db6f2b0ebe05ae807628778835b62df00eca2 (diff)
Don't leak formats that get merged
ea55492a6e55290d92a59324b3cb31ed958981ab follow-up Change-Id: Ib94a5a2c2ef6ebc7552c67975683dc18a9a5a744 Reviewed-on: https://gerrit.libreoffice.org/45723 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sc/source/filter/xml/xmlcondformat.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx
index 08e8dbf827b5..1d2cab79dd76 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -223,7 +223,7 @@ void SAL_CALL ScXMLConditionalFormatContext::endFastElement( sal_Int32 /*nElemen
ScDocument* pDoc = GetScImport().GetDocument();
SCTAB nTab = GetScImport().GetTables().GetCurrentSheet();
- ScConditionalFormat* pFormat = mxFormat.release();
+ std::unique_ptr<ScConditionalFormat> pFormat(std::move(mxFormat));
bool bEligibleForCache = true;
bool bSingleRelativeReference = false;
@@ -337,17 +337,17 @@ void SAL_CALL ScXMLConditionalFormatContext::endFastElement( sal_Int32 /*nElemen
nIndexOfOldest = (&aCacheEntry - &mrParent.maCache.front());
}
}
- mrParent.maCache[nIndexOfOldest].mpFormat = pFormat;
+ mrParent.maCache[nIndexOfOldest].mpFormat = pFormat.get();
mrParent.maCache[nIndexOfOldest].mbSingleRelativeReference = bSingleRelativeReference;
mrParent.maCache[nIndexOfOldest].mpTokens.reset(pTokens);
mrParent.maCache[nIndexOfOldest].mnAge = 0;
}
- sal_uLong nIndex = pDoc->AddCondFormat(pFormat, nTab);
+ sal_uLong nIndex = pDoc->AddCondFormat(pFormat.get(), nTab);
(void) nIndex; // Avoid 'unused variable' warning when assert() expands to empty
assert(pFormat->GetKey() == nIndex);
- mrParent.mvCondFormatData.push_back( { pFormat, nTab } );
+ mrParent.mvCondFormatData.push_back( { pFormat.release(), nTab } );
}
ScXMLConditionalFormatContext::~ScXMLConditionalFormatContext()