summaryrefslogtreecommitdiff
path: root/vcl/source/font/PhysicalFontFamily.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-05 14:48:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-07 13:27:53 +0200
commit77a01802d1a0452814718789bb0c76adeeb747c0 (patch)
tree00198f9cc2c3e4ea4f91597adebb1c52eb6cc395 /vcl/source/font/PhysicalFontFamily.cxx
parentd9fc8b494be53bacffe45564e98da61ae5b28bd3 (diff)
manage PhysicalFontFace by rtl::Reference
Change-Id: I8f66b5afb066fe83abb83c56ebde6f21197f894b Reviewed-on: https://gerrit.libreoffice.org/55333 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/font/PhysicalFontFamily.cxx')
-rw-r--r--vcl/source/font/PhysicalFontFamily.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx
index 34ad038a38a7..d0c1c2dad165 100644
--- a/vcl/source/font/PhysicalFontFamily.cxx
+++ b/vcl/source/font/PhysicalFontFamily.cxx
@@ -100,7 +100,7 @@ PhysicalFontFamily::~PhysicalFontFamily()
{
}
-bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
+void PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
{
if( maFontFaces.empty() )
{
@@ -162,19 +162,18 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
// ignore duplicate if its quality is worse
if( pNewFontFace->GetQuality() < pFoundFontFace->GetQuality() )
- return false;
+ return;
// keep the device font if its quality is good enough
if( pNewFontFace->GetQuality() == pFoundFontFace->GetQuality() )
- return false;
+ return;
// replace existing font face with a better one
- it->reset(pNewFontFace); // insert at sort position
- return true;
+ *it = pNewFontFace; // insert at sort position
+ return;
}
maFontFaces.emplace(it, pNewFontFace); // insert at sort position
- return true;
}
// get font attributes using the normalized font family name
@@ -265,7 +264,7 @@ void PhysicalFontFamily::UpdateCloneFontList(PhysicalFontCollection& rFontCollec
pFamily = rFontCollection.FindOrCreateFontFamily(aFamilyName);
}
assert(pFamily);
- PhysicalFontFace* pClonedFace = pFoundFontFace->Clone();
+ rtl::Reference<PhysicalFontFace> pClonedFace = pFoundFontFace->Clone();
#if OSL_DEBUG_LEVEL > 0
OUString aClonedFamilyName = GetEnglishSearchFontName( pClonedFace->GetFamilyName() );
@@ -273,8 +272,7 @@ void PhysicalFontFamily::UpdateCloneFontList(PhysicalFontCollection& rFontCollec
assert( rFontCollection.FindOrCreateFontFamily( aClonedFamilyName ) == pFamily );
#endif
- if (! pFamily->AddFontFace( pClonedFace ) )
- delete pClonedFace;
+ pFamily->AddFontFace( pClonedFace.get() );
}
}