Purge the Skia font cache after deleting an engine's FontCollection (flutter/engine#5598)

See https://github.com/flutter/flutter/issues/18728
This commit is contained in:
Jason Simmons
2018-06-25 13:23:46 -07:00
committed by GitHub
parent 2f5609f9b2
commit ae15662103

View File

@@ -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<txt::FontCollection> FontCollection::GetFontCollection() const {
return collection_;