Fix a crash introduced in the previous commit

The signatures of row-inserted and row-deleted are not
identical, so we need to be a bit more careful here.
This commit is contained in:
Matthias Clasen 2017-12-19 14:17:55 -05:00
parent 1b05474979
commit 5478bd59bf
2 changed files with 5 additions and 8 deletions

View File

@ -547,14 +547,11 @@ gtk_font_chooser_widget_update_preview_attributes (GtkFontChooserWidget *fontcho
} }
static void static void
rows_changed_cb (GtkTreeModel *model, rows_changed_cb (GtkFontChooserWidget *fontchooser)
GtkTreePath *path,
gpointer user_data)
{ {
GtkFontChooserWidget *fontchooser = user_data;
GtkFontChooserWidgetPrivate *priv = fontchooser->priv; GtkFontChooserWidgetPrivate *priv = fontchooser->priv;
if (gtk_tree_model_iter_n_children (model, NULL) == 0) if (gtk_tree_model_iter_n_children (priv->filter_model, NULL) == 0)
gtk_stack_set_visible_child_name (GTK_STACK (priv->list_stack), "empty"); gtk_stack_set_visible_child_name (GTK_STACK (priv->list_stack), "empty");
else else
gtk_stack_set_visible_child_name (GTK_STACK (priv->list_stack), "list"); gtk_stack_set_visible_child_name (GTK_STACK (priv->list_stack), "list");
@ -815,7 +812,7 @@ gtk_font_chooser_widget_load_fonts (GtkFontChooserWidget *fontchooser,
g_free (families); g_free (families);
rows_changed_cb (priv->filter_model, NULL, fontchooser); rows_changed_cb (fontchooser);
g_signal_handlers_unblock_by_func (priv->filter_model, rows_changed_cb, fontchooser); g_signal_handlers_unblock_by_func (priv->filter_model, rows_changed_cb, fontchooser);
g_signal_handlers_unblock_by_func (priv->family_face_list, cursor_changed_cb, fontchooser); g_signal_handlers_unblock_by_func (priv->family_face_list, cursor_changed_cb, fontchooser);

View File

@ -15,8 +15,8 @@
</object> </object>
<object class="GtkTreeModelFilter" id="filter_model"> <object class="GtkTreeModelFilter" id="filter_model">
<property name="child-model">model</property> <property name="child-model">model</property>
<signal name="row-deleted" handler="rows_changed_cb" swapped="no"/> <signal name="row-deleted" handler="rows_changed_cb" swapped="yes"/>
<signal name="row-inserted" handler="rows_changed_cb" swapped="no"/> <signal name="row-inserted" handler="rows_changed_cb" swapped="yes"/>
</object> </object>
<object class="GtkAdjustment" id="slider_adjustment"> <object class="GtkAdjustment" id="slider_adjustment">
<property name="upper">100</property> <property name="upper">100</property>