diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-08-06 14:35:19 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-08-06 14:35:19 -0400 |
commit | c13d70479bfa223d44c21c16cf8a071e85d8e726 (patch) | |
tree | 6caeef9f21b01de9d5ae2c864effd2669877d6d1 | |
parent | ecd50891ffe74900c15e56f53208061578801594 (diff) | |
download | gtk+-c13d70479bfa223d44c21c16cf8a071e85d8e726.tar.gz |
gridview: Work around unexpected focus changes
As things currently stand, we get events for focus changes
before the widget is allocated, and try to scroll in response.
Therefore, leaving n_columns at 0 until size-allocate leads
to plenty of division-by-zero. Just set it to 1 initially
to avoid that. This is a workaround for #3025.
-rw-r--r-- | gtk/gtkgridview.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gtk/gtkgridview.c b/gtk/gtkgridview.c index ecbb741f8f..a945683b03 100644 --- a/gtk/gtkgridview.c +++ b/gtk/gtkgridview.c @@ -1167,6 +1167,7 @@ gtk_grid_view_init (GtkGridView *self) self->min_columns = 1; self->max_columns = DEFAULT_MAX_COLUMNS; + self->n_columns = 1; gtk_list_base_set_anchor_max_widgets (GTK_LIST_BASE (self), self->max_columns * GTK_GRID_VIEW_MAX_VISIBLE_ROWS, |