From a7ff945ca031324f060b0d989f7a89594fcfe9fe Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 May 2021 11:22:05 +0200 Subject: add SfxItemPoolDeleter utility add use so we can hold the pool with std::unique_ptr Change-Id: I685fbc37c0ae145a5b48a66a88eab9fb29a0fc0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115174 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/svl/itempool.hxx | 13 ++++++++++--- include/svx/unopool.hxx | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx index 10dbd3252c9e..12e525722d6a 100644 --- a/include/svl/itempool.hxx +++ b/include/svl/itempool.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SVL_ITEMPOOL_HXX -#define INCLUDED_SVL_ITEMPOOL_HXX +#pragma once #include #include @@ -233,6 +232,14 @@ inline sal_uInt32 SfxItemPool::ReleaseRef(const SfxPoolItem& rItem, sal_uInt32 n return rItem.ReleaseRef(n); } -#endif +// Utility class for using SfxItemPool with std::unique_ptr +struct SfxItemPoolDeleter +{ + void operator()(SfxItemPool* pPool) + { + SfxItemPool::Free(pPool); + } +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/unopool.hxx b/include/svx/unopool.hxx index ff6c83472b98..d7736c36f7c2 100644 --- a/include/svx/unopool.hxx +++ b/include/svx/unopool.hxx @@ -25,6 +25,7 @@ #include #include #include +#include class SdrModel; class SfxItemPool; @@ -89,7 +90,7 @@ protected: protected: SdrModel* mpModel; - SfxItemPool* mpDefaultsPool; + std::unique_ptr mpDefaultsPool; }; #endif -- cgit