From 3f6714ea7d3dea191e8edb7404c0302d36b0377a Mon Sep 17 00:00:00 2001 From: jules Date: Fri, 5 Oct 2012 17:50:17 +0100 Subject: [PATCH] Fixed a leak. --- modules/juce_graphics/fonts/juce_Font.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/juce_graphics/fonts/juce_Font.cpp b/modules/juce_graphics/fonts/juce_Font.cpp index 22ff7b59ac..17cd124f4a 100644 --- a/modules/juce_graphics/fonts/juce_Font.cpp +++ b/modules/juce_graphics/fonts/juce_Font.cpp @@ -202,7 +202,7 @@ public: typefaceName = Font::getDefaultSansSerifFontName(); } - SharedFontInternal (const Typeface::Ptr& face) noexcept + explicit SharedFontInternal (const Typeface::Ptr& face) noexcept : typefaceName (face->getName()), typefaceStyle (face->getStyle()), height (FontValues::defaultFontHeight), @@ -215,6 +215,18 @@ public: jassert (typefaceName.isNotEmpty()); } + SharedFontInternal (const SharedFontInternal& other) noexcept + : typefaceName (other.typefaceName), + typefaceStyle (other.typefaceStyle), + height (other.height), + horizontalScale (other.horizontalScale), + kerning (other.kerning), + ascent (other.ascent), + underline (other.underline), + typeface (other.typeface) + { + } + bool operator== (const SharedFontInternal& other) const noexcept { return height == other.height @@ -253,8 +265,7 @@ Font::Font (const String& typefaceName, const float fontHeight, const int styleF } Font::Font (const String& typefaceName, const String& typefaceStyle, float fontHeight) - : font (new SharedFontInternal (typefaceName, typefaceStyle, - FontValues::limitFontHeight (fontHeight), false)) + : font (new SharedFontInternal (typefaceName, typefaceStyle, FontValues::limitFontHeight (fontHeight), false)) { }