From ae15662103a23b02eff1b7bce1c76c7dac8a175d Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 25 Jun 2018 13:23:46 -0700 Subject: [PATCH] Purge the Skia font cache after deleting an engine's FontCollection (flutter/engine#5598) See https://github.com/flutter/flutter/issues/18728 --- engine/src/flutter/lib/ui/text/font_collection.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/lib/ui/text/font_collection.cc b/engine/src/flutter/lib/ui/text/font_collection.cc index 67012519c9..b0ecc7514b 100644 --- a/engine/src/flutter/lib/ui/text/font_collection.cc +++ b/engine/src/flutter/lib/ui/text/font_collection.cc @@ -11,6 +11,7 @@ #include "third_party/rapidjson/rapidjson/document.h" #include "third_party/rapidjson/rapidjson/rapidjson.h" #include "third_party/skia/include/core/SkFontMgr.h" +#include "third_party/skia/include/core/SkGraphics.h" #include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkTypeface.h" #include "txt/asset_font_manager.h" @@ -24,7 +25,10 @@ FontCollection::FontCollection() collection_->SetDefaultFontManager(SkFontMgr::RefDefault()); } -FontCollection::~FontCollection() = default; +FontCollection::~FontCollection() { + collection_.reset(); + SkGraphics::PurgeFontCache(); +} std::shared_ptr FontCollection::GetFontCollection() const { return collection_;