summaryrefslogtreecommitdiff
path: root/sc/source/core/data/documen2.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-11 16:17:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-11 21:54:08 +0200
commit4cb85b20ae5a8ddda46b74382d60ec89b1b41320 (patch)
tree41f14d70ccf161842045646f1b0b8b21abae3d92 /sc/source/core/data/documen2.cxx
parentb71815a8d49f95657ce8253434187827e63a5ade (diff)
use unique_ptr for ScLookupCacheMap
Change-Id: Ib09a5331dfd57a99852555348c46730368d8d61d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100531 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/core/data/documen2.cxx')
-rw-r--r--sc/source/core/data/documen2.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index e4413853aa71..9d8ed27a82ce 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1151,14 +1151,14 @@ void ScDocument::DisposeFieldEditEngine(std::unique_ptr<ScFieldEditEngine>& rpEd
ScLookupCache & ScDocument::GetLookupCache( const ScRange & rRange, ScInterpreterContext* pContext )
{
ScLookupCache* pCache = nullptr;
- ScLookupCacheMap*& rpCacheMap = pContext->mScLookupCache;
- if (!rpCacheMap)
- rpCacheMap = new ScLookupCacheMap;
+ if (!pContext->mxScLookupCache)
+ pContext->mxScLookupCache.reset(new ScLookupCacheMap);
+ ScLookupCacheMap* pCacheMap = pContext->mxScLookupCache.get();
// insert with temporary value to avoid doing two lookups
- auto [findIt, bInserted] = rpCacheMap->aCacheMap.emplace(rRange, nullptr);
+ auto [findIt, bInserted] = pCacheMap->aCacheMap.emplace(rRange, nullptr);
if (bInserted)
{
- findIt->second = std::make_unique<ScLookupCache>(this, rRange, *rpCacheMap);
+ findIt->second = std::make_unique<ScLookupCache>(this, rRange, *pCacheMap);
pCache = findIt->second.get();
// The StartListeningArea() call is not thread-safe, as all threads
// would access the same SvtBroadcaster.
@@ -1193,7 +1193,7 @@ void ScDocument::RemoveLookupCache( ScLookupCache & rCache )
void ScDocument::ClearLookupCaches()
{
assert(!IsThreadedGroupCalcInProgress());
- DELETEZ(GetNonThreadedContext().mScLookupCache);
+ GetNonThreadedContext().mxScLookupCache.reset();
// Clear lookup cache in all interpreter-contexts in the (threaded/non-threaded) pools.
ScInterpreterContextPool::ClearLookupCaches();
}