mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
ncplane_destroy(): pull it out of the zbuffer #26
This commit is contained in:
parent
01beeb07b8
commit
2dde60c27a
@ -372,13 +372,23 @@ ncplane* notcurses_newplane(notcurses* nc, int rows, int cols,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ncplane_destroy(notcurses* nc, ncplane* ncp){
|
int ncplane_destroy(notcurses* nc, ncplane* ncp){
|
||||||
if(ncp){
|
if(ncp == NULL){
|
||||||
if(nc->stdscr == ncp){
|
return 0;
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// FIXME close it up
|
|
||||||
}
|
}
|
||||||
return 0;
|
if(nc->stdscr == ncp){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ncplane** above;
|
||||||
|
// pull it out of the list
|
||||||
|
for(above = &nc->top ; *above ; above = &(*above)->z){
|
||||||
|
if(*above == ncp){
|
||||||
|
*above = ncp->z;
|
||||||
|
free_plane(ncp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// couldn't find it in our stack. don't try to free this interloper.
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user