From 6d6f69a02bf6fad66e986bb1951b3771041ae5d0 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 7 Jul 2021 01:36:34 -0400 Subject: [PATCH] rebuild: only free auxvec for non-animation #1895 --- src/lib/internal.h | 6 ++++-- src/lib/kitty.c | 2 +- src/lib/sixel.c | 2 +- src/poc/bitmapstates.c | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/internal.h b/src/lib/internal.h index 4fbf00450..a85e0bbd3 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -705,8 +705,10 @@ sprite_rebuild(const notcurses* nc, sprixel* s, int ycell, int xcell){ uint8_t* auxvec = s->n->tam[idx].auxvector; assert(auxvec); ret = nc->tcache.pixel_rebuild(s, ycell, xcell, auxvec); - free(auxvec); - s->n->tam[idx].auxvector = NULL; + if(ret > 0){ + free(auxvec); + s->n->tam[idx].auxvector = NULL; + } } // don't upset SPRIXEL_MOVED if(s->invalidated == SPRIXEL_QUIESCENT){ diff --git a/src/lib/kitty.c b/src/lib/kitty.c index d7a81cb0a..7bd57de7d 100644 --- a/src/lib/kitty.c +++ b/src/lib/kitty.c @@ -332,7 +332,7 @@ int kitty_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec){ if(--targy == 0){ s->n->tam[s->dimx * ycell + xcell].state = state; s->invalidated = SPRIXEL_INVALIDATED; - return 0; + return 1; } thisrow = targx; //fprintf(stderr, "BUMP IT: %d %d %d %d\n", nextpixel, s->pixx, targx, chomped); diff --git a/src/lib/sixel.c b/src/lib/sixel.c index 42656cb67..2baa95835 100644 --- a/src/lib/sixel.c +++ b/src/lib/sixel.c @@ -914,7 +914,7 @@ int sixel_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec){ newstate = SPRIXCELL_OPAQUE_SIXEL; } s->n->tam[s->dimx * ycell + xcell].state = newstate; - return 0; + return 1; } // 80 (sixel scrolling) is enabled by default. 8452 is not. XTSAVE/XTRESTORE diff --git a/src/poc/bitmapstates.c b/src/poc/bitmapstates.c index b80d531d4..eef84d3bb 100644 --- a/src/poc/bitmapstates.c +++ b/src/poc/bitmapstates.c @@ -148,6 +148,7 @@ wipebitmap(struct notcurses* nc){ int main(void){ struct notcurses_options opts = { + .loglevel = NCLOGLEVEL_TRACE, }; struct notcurses* nc = notcurses_core_init(&opts, NULL); if(notcurses_check_pixel_support(nc) < 1){