[Libreoffice-commits] core.git: vcl/unx

Noel Grandin noel.grandin at collabora.co.uk
Wed May 2 08:20:22 UTC 2018


 vcl/unx/generic/gdi/gcach_xpeer.cxx |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

New commits:
commit 2ae289d67413a4f060b268a4483c3452c14aed42
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Apr 30 15:13:49 2018 +0200

    loplugin:useuniqueptr in GlyphCacheHolder
    
    Change-Id: I09aca185c6ca2efee037225e9924876030f47efe
    Reviewed-on: https://gerrit.libreoffice.org/53705
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/unx/generic/gdi/gcach_xpeer.cxx b/vcl/unx/generic/gdi/gcach_xpeer.cxx
index 172fd4e45721..863d0a77cf8a 100644
--- a/vcl/unx/generic/gdi/gcach_xpeer.cxx
+++ b/vcl/unx/generic/gdi/gcach_xpeer.cxx
@@ -61,29 +61,24 @@ namespace
     struct GlyphCacheHolder
     {
     private:
-        X11GlyphCache* m_pX11GlyphCache;
+        std::unique_ptr<X11GlyphCache> m_pX11GlyphCache;
 
         GlyphCacheHolder(const GlyphCacheHolder&) = delete;
         GlyphCacheHolder& operator=(const GlyphCacheHolder&) = delete;
 
     public:
         GlyphCacheHolder()
+            : m_pX11GlyphCache(new X11GlyphCache)
         {
-            m_pX11GlyphCache = new X11GlyphCache;
         }
         void release()
         {
-            delete m_pX11GlyphCache;
-            m_pX11GlyphCache = nullptr;
+            m_pX11GlyphCache.reset();
         }
         X11GlyphCache& getGlyphCache()
         {
             return *m_pX11GlyphCache;
         }
-        ~GlyphCacheHolder()
-        {
-            release();
-        }
     };
 
     struct theGlyphCacheHolder :


More information about the Libreoffice-commits mailing list