mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
fix _screen leak
This commit is contained in:
parent
4b65e43c54
commit
24c4c46b98
2 changed files with 8 additions and 15 deletions
|
@ -549,6 +549,8 @@ drawfreedimage(DImage *dimage)
|
||||||
}
|
}
|
||||||
ds = dimage->dscreen;
|
ds = dimage->dscreen;
|
||||||
l = dimage->image;
|
l = dimage->image;
|
||||||
|
dimage->dscreen = nil; /* paranoia */
|
||||||
|
dimage->image = nil;
|
||||||
if(ds){
|
if(ds){
|
||||||
if(l->data == screenimage->data)
|
if(l->data == screenimage->data)
|
||||||
addflush(l->layer->screenr);
|
addflush(l->layer->screenr);
|
||||||
|
@ -599,23 +601,14 @@ static
|
||||||
int
|
int
|
||||||
drawuninstall(Client *client, int id)
|
drawuninstall(Client *client, int id)
|
||||||
{
|
{
|
||||||
DImage *d, *next;
|
DImage *d, **l;
|
||||||
|
|
||||||
d = client->dimage[id&HASHMASK];
|
for(l=&client->dimage[id&HASHMASK]; (d=*l) != nil; l=&d->next){
|
||||||
if(d == 0)
|
if(d->id == id){
|
||||||
return -1;
|
*l = d->next;
|
||||||
if(d->id == id){
|
drawfreedimage(d);
|
||||||
client->dimage[id&HASHMASK] = d->next;
|
|
||||||
drawfreedimage(d);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
while(next = d->next){ /* assign = */
|
|
||||||
if(next->id == id){
|
|
||||||
d->next = next->next;
|
|
||||||
drawfreedimage(next);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
d = next;
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,7 @@ getwindow(Display *d, int ref)
|
||||||
d->image = i;
|
d->image = i;
|
||||||
/* fprint(2, "getwindow %p -> %p\n", oi, i); */
|
/* fprint(2, "getwindow %p -> %p\n", oi, i); */
|
||||||
|
|
||||||
|
freescreen(_screen);
|
||||||
_screen = allocscreen(i, d->white, 0);
|
_screen = allocscreen(i, d->white, 0);
|
||||||
_freeimage1(screen);
|
_freeimage1(screen);
|
||||||
screen = _allocwindow(screen, _screen, i->r, ref, DWhite);
|
screen = _allocwindow(screen, _screen, i->r, ref, DWhite);
|
||||||
|
@ -550,7 +551,6 @@ xattach(char *label)
|
||||||
return _x.screenimage;
|
return _x.screenimage;
|
||||||
|
|
||||||
err0:
|
err0:
|
||||||
fprint(2, "%r\n");
|
|
||||||
/*
|
/*
|
||||||
* Should do a better job of cleaning up here.
|
* Should do a better job of cleaning up here.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue