Don't add reference in get_unicode_funcs() functions
Users don't expect a new reference returned from a get() function. Indeed, all users of that API I foud where NOT destroying the reference. Just change the implementations to NOT return a reference. This applies to the following APIs: hb_unicode_funcs_get_default() hb_glib_get_unicode_funcs() hb_icu_get_unicode_funcs() Fixes https://github.com/harfbuzz/harfbuzz/issues/1134
This commit is contained in:
parent
9bbd1cdf06
commit
f0ef096b8c
|
@ -216,7 +216,7 @@ hb_buffer_t::reset (void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hb_unicode_funcs_destroy (unicode);
|
hb_unicode_funcs_destroy (unicode);
|
||||||
unicode = hb_unicode_funcs_get_default ();
|
unicode = hb_unicode_funcs_reference (hb_unicode_funcs_get_default ());
|
||||||
flags = HB_BUFFER_FLAG_DEFAULT;
|
flags = HB_BUFFER_FLAG_DEFAULT;
|
||||||
replacement = HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT;
|
replacement = HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT;
|
||||||
|
|
||||||
|
@ -908,7 +908,6 @@ hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
|
||||||
if (!unicode_funcs)
|
if (!unicode_funcs)
|
||||||
unicode_funcs = hb_unicode_funcs_get_default ();
|
unicode_funcs = hb_unicode_funcs_get_default ();
|
||||||
|
|
||||||
|
|
||||||
hb_unicode_funcs_reference (unicode_funcs);
|
hb_unicode_funcs_reference (unicode_funcs);
|
||||||
hb_unicode_funcs_destroy (buffer->unicode);
|
hb_unicode_funcs_destroy (buffer->unicode);
|
||||||
buffer->unicode = unicode_funcs;
|
buffer->unicode = unicode_funcs;
|
||||||
|
|
|
@ -401,7 +401,7 @@ void free_static_glib_funcs (void)
|
||||||
hb_unicode_funcs_t *
|
hb_unicode_funcs_t *
|
||||||
hb_glib_get_unicode_funcs (void)
|
hb_glib_get_unicode_funcs (void)
|
||||||
{
|
{
|
||||||
return hb_unicode_funcs_reference (static_glib_funcs.get_unconst ());
|
return static_glib_funcs.get_unconst ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -390,5 +390,5 @@ void free_static_icu_funcs (void)
|
||||||
hb_unicode_funcs_t *
|
hb_unicode_funcs_t *
|
||||||
hb_icu_get_unicode_funcs (void)
|
hb_icu_get_unicode_funcs (void)
|
||||||
{
|
{
|
||||||
return hb_unicode_funcs_reference (static_icu_funcs.get_unconst ());
|
return static_icu_funcs.get_unconst ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,5 +275,5 @@ extern "C" HB_INTERNAL
|
||||||
hb_unicode_funcs_t *
|
hb_unicode_funcs_t *
|
||||||
hb_ucdn_get_unicode_funcs (void)
|
hb_ucdn_get_unicode_funcs (void)
|
||||||
{
|
{
|
||||||
return hb_unicode_funcs_reference (static_ucdn_funcs.get_unconst ());
|
return static_ucdn_funcs.get_unconst ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue