diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-11-29 22:36:04 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-11-29 22:36:04 +0000 |
| commit | 8b7158703de69d0a3977491fd9a7ec17c86c4199 (patch) | |
| tree | 2a47dba5686c0a95893ad6a037d7e3f5d8c158f0 | |
| parent | term: xcursor: use 'hand2' instead of 'left_ptr' when mouse tracking (diff) | |
term: reset: don't access rows directly
We've just re-set the grid offsets, meaning rows 0..term->rows may not
all have been initialized.
Call grid_row_and_alloc() to ensure they are.
| -rw-r--r-- | terminal.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -869,8 +869,8 @@ term_reset(struct terminal *term, bool hard) term->normal.offset = term->normal.view = 0; term->alt.offset = term->alt.view = 0; for (size_t i = 0; i < term->rows; i++) { - memset(term->normal.rows[i]->cells, 0, term->cols * sizeof(struct cell)); - memset(term->alt.rows[i]->cells, 0, term->cols * sizeof(struct cell)); + memset(grid_row_and_alloc(&term->normal, i)->cells, 0, term->cols * sizeof(struct cell)); + memset(grid_row_and_alloc(&term->alt, i)->cells, 0, term->cols * sizeof(struct cell)); } for (size_t i = term->rows; i < term->normal.num_rows; i++) { grid_row_free(term->normal.rows[i]); |
