diff --git a/core-text/src/font_collection.rs b/core-text/src/font_collection.rs index 5103e8a1..dda043c5 100644 --- a/core-text/src/font_collection.rs +++ b/core-text/src/font_collection.rs @@ -38,15 +38,13 @@ impl_CFTypeDescription!(CTFontCollection); impl CTFontCollection { pub fn get_descriptors(&self) -> Option> { - // surprise! this function follows the Get rule, despite being named *Create*. - // So we have to addRef it to avoid CTFontCollection from double freeing it later. unsafe { let font_descriptors = CTFontCollectionCreateMatchingFontDescriptors(self.0); if font_descriptors.is_null() { // This returns null if there are no matching font descriptors. None } else { - Some(CFArray::wrap_under_get_rule(font_descriptors)) + Some(CFArray::wrap_under_create_rule(font_descriptors)) } } }