cherry-pick auxvector release fix #1598

pull/1604/head
nick black 3 years ago
parent 921311999d
commit 25afcbe49d
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -269,14 +269,7 @@ void free_plane(ncplane* p){
if(p->sprite){
sprixel_hide(p->sprite);
}
if(p->tam){
for(int y = 0 ; y < p->leny ; ++y){
for(int x = 0 ; x < p->lenx ; ++x){
free(p->tam[y * p->lenx + x].auxvector);
}
}
free(p->tam);
}
free(p->tam);
egcpool_dump(&p->pool);
free(p->name);
free(p->fb);

@ -144,9 +144,11 @@ highcontrast(uint32_t bchannel){
// at least for this rendering cycle
static void
paint_sprixel(ncplane* p, struct crender* rvec, int starty, int startx,
int dimy, int dimx, int offy, int offx, int dstleny, int dstlenx){
int offy, int offx, int dstleny, int dstlenx){
const notcurses* nc = ncplane_notcurses_const(p);
sprixel* s = p->sprite;
int dimy = s->dimy;
int dimx = s->dimx;
for(int y = starty ; y < dimy ; ++y){
const int absy = y + offy;
// once we've passed the physical screen's bottom, we're done
@ -229,8 +231,7 @@ paint(ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
// glyph, but we *do* need to null out any cellregions that we've
// scribbled upon.
if(p->sprite){
paint_sprixel(p, rvec, starty, startx, dimy, dimx, offy, offx,
dstleny, dstlenx);
paint_sprixel(p, rvec, starty, startx, offy, offx, dstleny, dstlenx);
// decouple from the pile's sixel list
if(p->sprite->next){
p->sprite->next->prev = p->sprite->prev;

@ -85,6 +85,12 @@ void sprixel_hide(sprixel* s){
s->movedfromy = ncplane_abs_y(s->n);
s->movedfromx = ncplane_abs_x(s->n);
if(s->n){
for(int y = 0 ; y < s->dimy ; ++y){
for(int x = 0 ; x < s->dimx ; ++x){
free(s->n->tam[y * s->dimx + x].auxvector);
s->n->tam[y * s->dimx + x].auxvector = NULL;
}
}
s->n->sprite = NULL;
s->n = NULL;
}

Loading…
Cancel
Save