Merge branch 'gtk3-fontchooser-fix' into 'gtk-3-24'

Fix a critical in GtkFontChooserWidget

See merge request GNOME/gtk!5027
This commit is contained in:
Matthias Clasen 2022-09-13 13:19:57 +00:00
commit cbfec14df4

View File

@ -963,27 +963,29 @@ gtk_font_chooser_widget_load_fonts (GtkFontChooserWidget *fontchooser,
if ((priv->level & GTK_FONT_CHOOSER_LEVEL_STYLE) == 0)
{
GtkDelayedFontDescription *desc;
PangoFontFace *face;
PangoFontFace *face = NULL;
#if PANGO_VERSION_CHECK(1,46,0)
face = pango_font_family_get_face (families[i], NULL);
#else
{
PangoFontFace **faces;
int j, n_faces;
pango_font_family_list_faces (families[i], &faces, &n_faces);
face = faces[0];
for (j = 0; j < n_faces; j++)
{
if (strcmp (pango_font_face_get_face_name (faces[j]), "Regular") == 0)
{
face = faces[j];
break;
}
}
g_free (faces);
}
#endif
if (!face)
{
PangoFontFace **faces;
int j, n_faces;
pango_font_family_list_faces (families[i], &faces, &n_faces);
face = faces[0];
for (j = 0; j < n_faces; j++)
{
if (strcmp (pango_font_face_get_face_name (faces[j]), "Regular") == 0)
{
face = faces[j];
break;
}
}
g_free (faces);
}
desc = gtk_delayed_font_description_new (face);
gtk_list_store_insert_with_values (list_store, &iter, -1,