summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-06-10 15:27:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-06-12 13:48:33 +0200
commit12a1c991935030c0d31f5b596244210d2f6d37f6 (patch)
tree175bdbfe62ee906ce52657441b476cb4b9b30405 /sc
parente5fdde91e3eab13777a4f929efc650cacb643c0c (diff)
fix ASAN in SharedStringPool
regression from commit 3581f1d71ae0d431ba28c0f3b7b263ff6212ce7b optimize SharedStringPool::purge() and fix tests which results in us potentially de-referencing an already de-allocated OUString object in the first loop in purge(). So switch to a different strategy, which only needs one data structure, instead of two. Change-Id: Iaac6beda48459643afdb7b14ce7d39d68a93339c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95226 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 5af636c5021ecf7fba8f5f34cc6af929f1e04b4c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96180
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/ucalc.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 0bc11aaeeaae..d3fa93c522c2 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -207,25 +207,25 @@ void Test::testSharedStringPool()
// Check the string counts after purging. Purging shouldn't remove any strings in this case.
svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool();
rPool.purge();
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rPool.getCount());
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), rPool.getCount());
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rPool.getCountIgnoreCase());
// Clear A1 and purge again.
clearRange(m_pDoc, ScAddress(0,0,0));
rPool.purge();
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rPool.getCount());
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), rPool.getCount());
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rPool.getCountIgnoreCase());
// Clear A2 and purge again.
clearRange(m_pDoc, ScAddress(0,1,0));
rPool.purge();
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), rPool.getCount());
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rPool.getCount());
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rPool.getCountIgnoreCase());
// Clear A3 and purge again.
clearRange(m_pDoc, ScAddress(0,2,0));
rPool.purge();
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rPool.getCount());
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), rPool.getCount());
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rPool.getCountIgnoreCase());
// Clear A4 and purge again.