aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-02-14 19:45:12 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-02-21 19:15:32 +0000
commitfd505f2274343d03e26847217c68e3c8f1f86e30 (patch)
tree2c9ed0a42b828d25dade67a217ddd3996d3bf492
parentgrid: grid_resize_without_reflow: transfer URI ranges (diff)
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.
-rw-r--r--grid.c3
1 files changed, 2 insertions, 1 deletions
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);
}
}