[Libreoffice-commits] core.git: sc/source
Mike Kaganski
mike.kaganski at collabora.com
Sun Dec 3 08:22:27 UTC 2017
sc/source/filter/xml/xmlcondformat.cxx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 8c89cfe3cdf6595d5f3bb87ecc45b9f450195aac
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Sat Dec 2 20:33:38 2017 +0200
Don't leak formats that get merged
ea55492a6e55290d92a59324b3cb31ed958981ab follow-up
Change-Id: Ib94a5a2c2ef6ebc7552c67975683dc18a9a5a744
Reviewed-on: https://gerrit.libreoffice.org/45723
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
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()
More information about the Libreoffice-commits
mailing list