render: use a unique buffer cookie for the 'search' surface

This fixes an issue where rendering the 'search' box caused the last
normal buffer from being purged.

This meant the terminal had a pointer to a now freed buffer, which we
de-referenced and occasionally memcpy:ied from.
This commit is contained in:
Daniel Eklöf 2020-01-03 12:05:48 +01:00
parent 9829539af8
commit 792b443918
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -886,7 +886,7 @@ render_search_box(struct terminal *term)
const int width = min(term->width, 2 * margin + max(20, term->search.len) * term->cell_width);
const int height = min(term->height, 2 * margin + 1 * term->cell_height);
unsigned long cookie = (uintptr_t)term;
unsigned long cookie = (uintptr_t)term + 1;
struct buffer *buf = shm_get_buffer(term->wl->shm, width, height, cookie);
/* Background - yellow on empty/match, red on mismatch */