summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-07 22:06:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-08 17:36:54 +0200
commit1545949690c750d7b512000723b564e69cf3c3a6 (patch)
tree1463c8b2912a9e269fe8b7ef3f7326dc85173830 /sw/source
parentc10ce2698a3b001d22db3d33f2f43513cc49ebda (diff)
ref-count SfxItemPool
so we can remove SfxItemPoolUser, which is a right performance hog when we have large calc spreadsheets Change-Id: I344002f536f6eead5cf98c6647dd1667fd9c8874 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115247 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/attr/swatrset.cxx14
-rw-r--r--sw/source/core/doc/docnew.cxx2
-rw-r--r--sw/source/uibase/app/swmodule.cxx4
3 files changed, 6 insertions, 14 deletions
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index f3b57d21a73c..1ec1d93323e1 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -51,7 +51,7 @@ SwAttrPool::SwAttrPool( SwDoc* pD )
// create SfxItemPool and EditEngine pool and add these in a chain. These
// belong us and will be removed/destroyed in removeAndDeleteSecondaryPools() used from
// the destructor
- SfxItemPool *pSdrPool = new SdrItemPool(this);
+ rtl::Reference<SfxItemPool> pSdrPool = new SdrItemPool(this);
// #75371# change DefaultItems for the SdrEdgeObj distance items
// to TWIPS.
@@ -69,9 +69,9 @@ SwAttrPool::SwAttrPool( SwDoc* pD )
pSdrPool->SetPoolDefaultItem(makeSdrShadowXDistItem(nDefShadowDist));
pSdrPool->SetPoolDefaultItem(makeSdrShadowYDistItem(nDefShadowDist));
- SfxItemPool *pEEgPool = EditEngine::CreatePool();
+ rtl::Reference<SfxItemPool> pEEgPool = EditEngine::CreatePool();
- pSdrPool->SetSecondaryPool(pEEgPool);
+ pSdrPool->SetSecondaryPool(pEEgPool.get());
if(!GetFrozenIdRanges())
{
@@ -87,17 +87,9 @@ SwAttrPool::~SwAttrPool()
{
// cleanup secondary pools
SfxItemPool *pSdrPool = GetSecondaryPool();
- SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool();
-
// first delete the items, then break the linking
pSdrPool->Delete();
-
SetSecondaryPool(nullptr);
- pSdrPool->SetSecondaryPool(nullptr);
-
- // final cleanup of secondary pool(s)
- SfxItemPool::Free(pSdrPool);
- SfxItemPool::Free(pEEgPool);
}
SwAttrSet::SwAttrSet( SwAttrPool& rPool, sal_uInt16 nWh1, sal_uInt16 nWh2 )
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 35a59e111406..a674beb9fde6 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -597,7 +597,7 @@ SwDoc::~SwDoc()
mpDfltCharFormat.reset();
mpDfltFrameFormat.reset();
mpLayoutCache.reset();
- mpAttrPool.reset();
+ mpAttrPool.clear();
}
void SwDoc::SetDocShell( SwDocShell* pDSh )
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index 6d15fcf2ff06..485bb7a52d41 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -331,14 +331,14 @@ void SwDLL::RegisterControls()
void SwModule::InitAttrPool()
{
OSL_ENSURE(!m_pAttrPool, "Pool already exists!");
- m_pAttrPool.reset(new SwAttrPool(nullptr));
+ m_pAttrPool = new SwAttrPool(nullptr);
SetPool(m_pAttrPool.get());
}
void SwModule::RemoveAttrPool()
{
SetPool(nullptr);
- m_pAttrPool.reset();
+ m_pAttrPool.clear();
}
std::unique_ptr<SfxStyleFamilies> SwModule::CreateStyleFamilies()