editeng/source/editeng/editeng.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 7c4a4652595d6e738bcc5a38060cc1754ab35520
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue May 4 16:01:08 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed May 5 08:40:07 2021 +0200

    don't leak editengine pool on shutdown
    
    Change-Id: I585953c26ed40acc51853b9ed5cd398b84472056
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115099
    Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

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;
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to