camv: fix leak on resize

front
qwx 2018-05-20 16:47:41 +02:00
parent 1f8d347c92
commit 2e717a5557
1 changed files with 3 additions and 1 deletions

View File

@ -39,8 +39,9 @@ emalloc(ulong n)
void
screeninit(void)
{
bg = allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0xCCCCCCFF);
freescreen(scr);
scr = allocscreen(screen, bg, 0);
freeimage(disp);
disp = allocwindow(scr, screen->r, 0, 0xCCCCCCFF);
draw(screen, screen->r, bg, nil, ZP);
flushimage(display, 1);
@ -225,6 +226,7 @@ threadmain(int argc, char **argv)
if(initdraw(nil, nil, "camv") < 0)
sysfatal("initdraw: %r");
bg = allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0xCCCCCCFF);
screeninit();
kc = initkeyboard(nil);
if(kc == nil) sysfatal("initkeyboard: %r");