Skip to content

Commit

Permalink
Plug memory leak in __DWriteTextLayoutApplyFont (#1788)
Browse files Browse the repository at this point in the history
Fixes #1766
  • Loading branch information
aballway authored Jan 24, 2017
1 parent f194201 commit aa8a8d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Frameworks/CoreText/DWriteWrapper_CoreText.mm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ static inline HRESULT __DWriteTextFormatApplyParagraphStyle(const ComPtr<IDWrite
* Private helper that applies a CTFontRef to an IDWriteTextLayout within the specified range.
*/
static inline HRESULT __DWriteTextLayoutApplyFont(const ComPtr<IDWriteTextLayout>& textLayout, CTFontRef font, DWRITE_TEXT_RANGE range) {
std::shared_ptr<const _DWriteFontProperties> properties = _DWriteGetFontPropertiesFromName(CTFontCopyName(font, kCTFontFullNameKey));
auto fontName = woc::MakeAutoCF<CFStringRef>(CTFontCopyName(font, kCTFontFullNameKey));
std::shared_ptr<const _DWriteFontProperties> properties = _DWriteGetFontPropertiesFromName(fontName);
RETURN_IF_FAILED(textLayout->SetFontWeight(properties->weight, range));
RETURN_IF_FAILED(textLayout->SetFontStretch(properties->stretch, range));
RETURN_IF_FAILED(textLayout->SetFontStyle(properties->style, range));
Expand Down

0 comments on commit aa8a8d4

Please sign in to comment.