You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
[macOS/iOS] Fix system font family descriptor leak.
(cherry picked from commit c5dcecc6f7)
This commit is contained in:
committed by
Rémi Verschelde
parent
ab037eada2
commit
efb3cf1db4
@@ -534,6 +534,7 @@ Vector<String> OS_IOS::get_system_font_path_for_text(const String &p_font_name,
|
|||||||
CTFontDescriptorRef font = CTFontDescriptorCreateWithAttributes(attributes);
|
CTFontDescriptorRef font = CTFontDescriptorCreateWithAttributes(attributes);
|
||||||
if (font) {
|
if (font) {
|
||||||
CTFontRef family = CTFontCreateWithFontDescriptor(font, 0, nullptr);
|
CTFontRef family = CTFontCreateWithFontDescriptor(font, 0, nullptr);
|
||||||
|
if (family) {
|
||||||
CFStringRef string = CFStringCreateWithCString(kCFAllocatorDefault, p_text.utf8().get_data(), kCFStringEncodingUTF8);
|
CFStringRef string = CFStringCreateWithCString(kCFAllocatorDefault, p_text.utf8().get_data(), kCFStringEncodingUTF8);
|
||||||
CFRange range = CFRangeMake(0, CFStringGetLength(string));
|
CFRange range = CFRangeMake(0, CFStringGetLength(string));
|
||||||
CTFontRef fallback_family = CTFontCreateForString(family, string, range);
|
CTFontRef fallback_family = CTFontCreateForString(family, string, range);
|
||||||
@@ -551,6 +552,8 @@ Vector<String> OS_IOS::get_system_font_path_for_text(const String &p_font_name,
|
|||||||
CFRelease(fallback_family);
|
CFRelease(fallback_family);
|
||||||
}
|
}
|
||||||
CFRelease(string);
|
CFRelease(string);
|
||||||
|
CFRelease(family);
|
||||||
|
}
|
||||||
CFRelease(font);
|
CFRelease(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -544,6 +544,7 @@ Vector<String> OS_MacOS::get_system_font_path_for_text(const String &p_font_name
|
|||||||
CTFontDescriptorRef font = CTFontDescriptorCreateWithAttributes(attributes);
|
CTFontDescriptorRef font = CTFontDescriptorCreateWithAttributes(attributes);
|
||||||
if (font) {
|
if (font) {
|
||||||
CTFontRef family = CTFontCreateWithFontDescriptor(font, 0, nullptr);
|
CTFontRef family = CTFontCreateWithFontDescriptor(font, 0, nullptr);
|
||||||
|
if (family) {
|
||||||
CFStringRef string = CFStringCreateWithCString(kCFAllocatorDefault, p_text.utf8().get_data(), kCFStringEncodingUTF8);
|
CFStringRef string = CFStringCreateWithCString(kCFAllocatorDefault, p_text.utf8().get_data(), kCFStringEncodingUTF8);
|
||||||
CFRange range = CFRangeMake(0, CFStringGetLength(string));
|
CFRange range = CFRangeMake(0, CFStringGetLength(string));
|
||||||
CTFontRef fallback_family = CTFontCreateForString(family, string, range);
|
CTFontRef fallback_family = CTFontCreateForString(family, string, range);
|
||||||
@@ -561,6 +562,8 @@ Vector<String> OS_MacOS::get_system_font_path_for_text(const String &p_font_name
|
|||||||
CFRelease(fallback_family);
|
CFRelease(fallback_family);
|
||||||
}
|
}
|
||||||
CFRelease(string);
|
CFRelease(string);
|
||||||
|
CFRelease(family);
|
||||||
|
}
|
||||||
CFRelease(font);
|
CFRelease(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user