From 487f0940377b4fbf9ebae8ab2a53f2f992e60deb Mon Sep 17 00:00:00 2001 From: Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> Date: Thu, 10 Oct 2019 22:05:48 +1100 Subject: Reduce memory leak on editing text, etc. --- src/libnrtype/FontInstance.cpp | 2 ++ src/libnrtype/font-lister.cpp | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src/libnrtype') diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 4204bcd11..e0fa2bec8 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -958,6 +958,7 @@ void font_instance::FindFontMetrics() { // std::cout << "Math baseline: - bbox: y_min: " << acbox.yMin // << " y_max: " << acbox.yMax // << " math: " << math << std::endl; + FT_Done_Glyph(aglyph); } // Find hanging baseline... assume it is at top of 'म'. @@ -971,6 +972,7 @@ void font_instance::FindFontMetrics() { double hanging = (double)acbox.yMax/(double)theFace->units_per_EM; _baselines[ SP_CSS_BASELINE_HANGING ] = hanging; // std::cout << "Hanging baseline: प: " << hanging << std::endl; + FT_Done_Glyph(aglyph); } } #endif diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index 984741adc..30283e624 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -411,7 +411,10 @@ void FontLister::update_font_data_recursive(SPObject& r, std::map