grid: resize_without_reflow: allocate ‘extra’ on-demand on ‘new’ rows

Even if we have URI ranges on the old row, all those ranges may lay
outside the new grid’s range.
This commit is contained in:
Daniel Eklöf 2021-02-14 20:45:12 +01:00
parent 8da82c897b
commit fd505f2274
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

3
grid.c
View file

@ -119,7 +119,6 @@ grid_resize_without_reflow(
if (old_row->extra == NULL)
continue;
new_row->extra = xcalloc(1, sizeof(*new_row->extra));
tll_foreach(old_row->extra->uri_ranges, it) {
if (it->item.start >= new_rows) {
/* The whole range is truncated */
@ -133,6 +132,8 @@ grid_resize_without_reflow(
.uri = xstrdup(it->item.uri),
};
if (new_row->extra == NULL)
new_row->extra = xcalloc(1, sizeof(*new_row->extra));
tll_push_back(new_row->extra->uri_ranges, range);
}
}