From fd505f2274343d03e26847217c68e3c8f1f86e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 14 Feb 2021 20:45:12 +0100 Subject: [PATCH] =?UTF-8?q?grid:=20resize=5Fwithout=5Freflow:=20allocate?= =?UTF-8?q?=20=E2=80=98extra=E2=80=99=20on-demand=20on=20=E2=80=98new?= =?UTF-8?q?=E2=80=99=20rows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even if we have URI ranges on the old row, all those ranges may lay outside the new grid’s range. --- grid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grid.c b/grid.c index 16924d1c..7e000b42 100644 --- a/grid.c +++ b/grid.c @@ -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); } }