ncpile_drop(): reset stdplane's blist #1226

pull/1232/head
nick black 4 years ago
parent 8fb8d55222
commit 9b0f88f024
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1187,16 +1187,25 @@ err:
// updates *pile to point at (*pile)->next, frees all but standard pile/plane // updates *pile to point at (*pile)->next, frees all but standard pile/plane
static void static void
ncpile_drop(notcurses* nc, ncpile** pile){ ncpile_drop(notcurses* nc, ncpile** pile){
bool sawstdplane = false;
ncpile* next = (*pile)->next; ncpile* next = (*pile)->next;
ncplane* p = (*pile)->top; ncplane* p = (*pile)->top;
while(p){ while(p){
ncplane* tmp = p->below; ncplane* tmp = p->below;
if(nc->stdplane != p){ if(nc->stdplane != p){
free_plane(p); free_plane(p);
}else{
sawstdplane = true;
} }
p = tmp; p = tmp;
} }
*pile = next; *pile = next;
if(sawstdplane){
ncplane_pile(nc->stdplane)->top = nc->stdplane;
ncplane_pile(nc->stdplane)->bottom = nc->stdplane;
nc->stdplane->above = nc->stdplane->below = NULL;
nc->stdplane->blist = NULL;
}
} }
// drop all piles and all planes, save the standard plane and its pile // drop all piles and all planes, save the standard plane and its pile
@ -1208,9 +1217,6 @@ void notcurses_drop_planes(notcurses* nc){
ncpile_drop(nc, &p); ncpile_drop(nc, &p);
}while(p0 != p); }while(p0 != p);
pthread_mutex_unlock(&nc->pilelock); pthread_mutex_unlock(&nc->pilelock);
ncplane_pile(nc->stdplane)->top = nc->stdplane;
ncplane_pile(nc->stdplane)->bottom = nc->stdplane;
nc->stdplane->above = nc->stdplane->below = NULL;
} }
int notcurses_stop(notcurses* nc){ int notcurses_stop(notcurses* nc){

Loading…
Cancel
Save