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

Noel Grandin noel.grandin at collabora.co.uk
Tue Apr 24 13:12:44 UTC 2018


 vcl/unx/generic/fontmanager/fontconfig.cxx |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 6ac3cf60a6b84f06c23f6e6208bc8994b7bcc7a4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Apr 23 15:20:41 2018 +0200

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

diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 639dc37591ae..3f9d39021175 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -88,7 +88,7 @@ public:
 private:
     void cacheLocalizedFontNames(const FcChar8 *origfontname, const FcChar8 *bestfontname, const std::vector< lang_and_element > &lang_and_elements);
 
-    LanguageTag* m_pLanguageTag;
+    std::unique_ptr<LanguageTag> m_pLanguageTag;
 };
 
 FontCfgWrapper::FontCfgWrapper()
@@ -354,7 +354,7 @@ FcResult FontCfgWrapper::LocalizedElementFromPattern(FcPattern const * pPattern,
             {
                 rtl_Locale* pLoc = nullptr;
                 osl_getProcessLocale(&pLoc);
-                m_pLanguageTag = new LanguageTag(*pLoc);
+                m_pLanguageTag.reset( new LanguageTag(*pLoc) );
             }
             *element = bestname(lang_and_elements, *m_pLanguageTag);
 
@@ -376,8 +376,7 @@ void FontCfgWrapper::clear()
         FcFontSetDestroy( m_pOutlineSet );
         m_pOutlineSet = nullptr;
     }
-    delete m_pLanguageTag;
-    m_pLanguageTag = nullptr;
+    m_pLanguageTag.reset();
 }
 
 /*


More information about the Libreoffice-commits mailing list