[Libreoffice-commits] core.git: vcl/inc vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 20 14:42:15 UTC 2018


 vcl/inc/PhysicalFontCollection.hxx         |    2 +-
 vcl/source/font/PhysicalFontCollection.cxx |   14 +++++++-------
 vcl/source/gdi/virdev.cxx                  |    2 +-
 vcl/source/outdev/font.cxx                 |    2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit d2c9c60fefb9687adbde4be61ed66a5123a2587f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 20 14:23:12 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Aug 20 16:41:51 2018 +0200

    make PhysicalFontCollection::Close return std::shared_ptr
    
    Change-Id: Iefa9df1d40c11cc56831467a03e0274475c50ed1
    Reviewed-on: https://gerrit.libreoffice.org/59327
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/PhysicalFontCollection.hxx b/vcl/inc/PhysicalFontCollection.hxx
index 46caab87c7c7..08ce6dcf98c1 100644
--- a/vcl/inc/PhysicalFontCollection.hxx
+++ b/vcl/inc/PhysicalFontCollection.hxx
@@ -63,7 +63,7 @@ public:
     void                    SetFallbackHook( ImplGlyphFallbackFontSubstitution* );
 
     // misc utilities
-    PhysicalFontCollection* Clone() const;
+    std::shared_ptr<PhysicalFontCollection> Clone() const;
     std::unique_ptr<ImplDeviceFontList> GetDeviceFontList() const;
     std::unique_ptr<ImplDeviceFontSizeList> GetDeviceFontSizeList( const OUString& rFontName ) const;
 
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
index 8df6104c97f9..38dedaf09645 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -866,22 +866,22 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefaultFont() co
     return pFoundData;
 }
 
-PhysicalFontCollection* PhysicalFontCollection::Clone() const
+std::shared_ptr<PhysicalFontCollection> PhysicalFontCollection::Clone() const
 {
-    PhysicalFontCollection* pClonedCollection = new PhysicalFontCollection;
-    pClonedCollection->mpPreMatchHook = mpPreMatchHook;
-    pClonedCollection->mpFallbackHook = mpFallbackHook;
+    std::shared_ptr<PhysicalFontCollection> xClonedCollection(new PhysicalFontCollection);
+    xClonedCollection->mpPreMatchHook = mpPreMatchHook;
+    xClonedCollection->mpFallbackHook = mpFallbackHook;
 
     // TODO: clone the config-font attributes too?
-    pClonedCollection->mbMatchData    = false;
+    xClonedCollection->mbMatchData    = false;
 
     for (auto const& family : maPhysicalFontFamilies)
     {
         const PhysicalFontFamily* pFontFace = family.second.get();
-        pFontFace->UpdateCloneFontList(*pClonedCollection);
+        pFontFace->UpdateCloneFontList(*xClonedCollection);
     }
 
-    return pClonedCollection;
+    return xClonedCollection;
 }
 
 std::unique_ptr<ImplDeviceFontList> PhysicalFontCollection::GetDeviceFontList() const
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index f48d9b3b1473..7a7c3b7d855c 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -499,7 +499,7 @@ void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32
 
     // get font list with scalable fonts only
     AcquireGraphics();
-    mxFontCollection.reset(pSVData->maGDIData.mxScreenFontList->Clone());
+    mxFontCollection = pSVData->maGDIData.mxScreenFontList->Clone();
 
     // prepare to use new font lists
     mxFontCache.reset(new ImplFontCache);
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 81a825fe17f8..72338d32bac1 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -581,7 +581,7 @@ void OutputDevice::ImplRefreshFontData( const bool bNewFontLists )
             {
                 if( mpPDFWriter )
                 {
-                    mxFontCollection.reset(pSVData->maGDIData.mxScreenFontList->Clone());
+                    mxFontCollection = pSVData->maGDIData.mxScreenFontList->Clone();
                     mxFontCache.reset(new ImplFontCache);
                 }
                 else


More information about the Libreoffice-commits mailing list