summaryrefslogtreecommitdiff
path: root/sw
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
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')
-rw-r--r--sw/inc/doc.hxx2
-rw-r--r--sw/inc/swmodule.hxx2
-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
5 files changed, 8 insertions, 16 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index ecfaa837a1cc..08510f634569 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -193,7 +193,7 @@ class SW_DLLPUBLIC SwDoc final
// private Member
std::unique_ptr<SwNodes> m_pNodes; //< document content (Nodes Array)
- std::unique_ptr<SwAttrPool, SfxItemPoolDeleter> mpAttrPool; //< the attribute pool
+ rtl::Reference<SwAttrPool> mpAttrPool; //< the attribute pool
SwPageDescs m_PageDescs; //< PageDescriptors
Link<bool,void> maOle2Link; //< OLE 2.0-notification
/* @@@MAINTAINABILITY-HORROR@@@
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index 6ba75632843a..987e75e61559 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -95,7 +95,7 @@ class SW_DLLPUBLIC SwModule final : public SfxModule, public SfxListener, public
std::unique_ptr<SfxErrorHandler> m_pErrorHandler;
- std::unique_ptr<SwAttrPool, SfxItemPoolDeleter> m_pAttrPool;
+ rtl::Reference<SwAttrPool> m_pAttrPool;
// Current view is held here in order to avoid one's being forced
// to work via GetActiveView.
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()