[util] Fix leak of an hb_font_t
This commit is contained in:
parent
da285d511f
commit
cd77846bd9
|
@ -83,6 +83,7 @@ static struct supported_font_funcs_t {
|
||||||
void
|
void
|
||||||
font_options_t::post_parse (GError **error)
|
font_options_t::post_parse (GError **error)
|
||||||
{
|
{
|
||||||
|
assert (!font);
|
||||||
font = hb_font_create (face);
|
font = hb_font_create (face);
|
||||||
|
|
||||||
if (font_size_x == FONT_SIZE_UPEM)
|
if (font_size_x == FONT_SIZE_UPEM)
|
||||||
|
@ -272,7 +273,8 @@ font_options_t::add_options (option_parser_t *parser)
|
||||||
"font",
|
"font",
|
||||||
"Font-instance options:",
|
"Font-instance options:",
|
||||||
"Options for the font instance",
|
"Options for the font instance",
|
||||||
this);
|
this,
|
||||||
|
false /* We add below. */);
|
||||||
|
|
||||||
const gchar *variations_help = "Comma-separated list of font variations\n"
|
const gchar *variations_help = "Comma-separated list of font variations\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
|
@ -110,11 +110,13 @@ struct option_parser_t
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
const gchar *description,
|
const gchar *description,
|
||||||
const gchar *help_description,
|
const gchar *help_description,
|
||||||
Type *closure)
|
Type *closure,
|
||||||
|
bool add_parse_hooks = true)
|
||||||
{
|
{
|
||||||
GOptionGroup *group = g_option_group_new (name, description, help_description,
|
GOptionGroup *group = g_option_group_new (name, description, help_description,
|
||||||
static_cast<gpointer>(closure), nullptr);
|
static_cast<gpointer>(closure), nullptr);
|
||||||
g_option_group_add_entries (group, entries);
|
g_option_group_add_entries (group, entries);
|
||||||
|
if (add_parse_hooks)
|
||||||
g_option_group_set_parse_hooks (group, nullptr, post_parse<Type>);
|
g_option_group_set_parse_hooks (group, nullptr, post_parse<Type>);
|
||||||
g_option_context_add_group (context, group);
|
g_option_context_add_group (context, group);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue