Don't leak ref returned by SkFontMgr::matchFamilyStyle.

The current code does an extra ref on the SkTypeface returned from
SkFontMgr::matchFamilyStyle. This old API needs to be updated to return
sk_sp<SkTypeface> instead of a ref'ed bare SkTypeface*.

Bug: skia:10325
Change-Id: I191b494fb86b99fc53b6eb850d65ba73e60dc489
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294038
Auto-Submit: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
This commit is contained in:
Ben Wagner 2020-06-03 22:14:28 -04:00 committed by Skia Commit-Bot
parent c3320be506
commit bfe44b6974

View File

@ -131,8 +131,8 @@ sk_sp<SkTypeface> FontCollection::defaultFallback() {
if (fDefaultFontManager == nullptr) {
return nullptr;
}
auto result = fDefaultFontManager->matchFamilyStyle(fDefaultFamilyName.c_str(), SkFontStyle());
return sk_ref_sp<SkTypeface>(result);
return sk_sp<SkTypeface>(fDefaultFontManager->matchFamilyStyle(fDefaultFamilyName.c_str(),
SkFontStyle()));
}