diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-04 16:01:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-05 08:40:07 +0200 |
commit | 7c4a4652595d6e738bcc5a38060cc1754ab35520 (patch) | |
tree | 8a0ac7c7f8460be700076bf95ed336a6fe533768 | |
parent | 53e720708b9d027a7df9908c75b1b82c8aca3c6a (diff) |
don't leak editengine pool on shutdown
Change-Id: I585953c26ed40acc51853b9ed5cd398b84472056
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115099
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 65eb808eb504..1b9e6b9e5cdd 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -82,7 +82,17 @@ using namespace ::com::sun::star::linguistic2; static bool bDebugPaint = false; #endif -static SfxItemPool* pGlobalPool=nullptr; + +namespace { +struct PoolDeleter +{ + void operator()(SfxItemPool* pPool) + { + SfxItemPool::Free(pPool); + }; +}; +} +static std::unique_ptr<SfxItemPool, PoolDeleter> pGlobalPool; EditEngine::EditEngine( SfxItemPool* pItemPool ) { @@ -2597,7 +2607,7 @@ SfxItemPool* EditEngine::CreatePool() SfxItemPool& EditEngine::GetGlobalItemPool() { if ( !pGlobalPool ) - pGlobalPool = CreatePool(); + pGlobalPool.reset(CreatePool()); return *pGlobalPool; } |