page: add missing delayfreeimage calls
fixes #19 http://code.swtch.com/plan9port/issue/19 http://codereview.appspot.com/108041
This commit is contained in:
parent
d19fdc056d
commit
94349f64d1
1 changed files with 14 additions and 2 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
Document *doc;
|
Document *doc;
|
||||||
Mousectl *mc;
|
Mousectl *mc;
|
||||||
Image *im;
|
Image *im;
|
||||||
|
Image *tofree;
|
||||||
int page;
|
int page;
|
||||||
int angle = 0;
|
int angle = 0;
|
||||||
int showbottom = 0; /* on the next showpage, move the image so the bottom is visible. */
|
int showbottom = 0; /* on the next showpage, move the image so the bottom is visible. */
|
||||||
|
|
@ -62,6 +63,16 @@ enum {
|
||||||
RMenu = 3,
|
RMenu = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
delayfreeimage(Image *m)
|
||||||
|
{
|
||||||
|
if(m == tofree)
|
||||||
|
return;
|
||||||
|
if(tofree)
|
||||||
|
freeimage(tofree);
|
||||||
|
tofree = m;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
unhide(void)
|
unhide(void)
|
||||||
{
|
{
|
||||||
|
|
@ -121,6 +132,7 @@ showpage(int page, Menu *m)
|
||||||
m->lasthit = reverse ? doc->npage-1-page : page;
|
m->lasthit = reverse ? doc->npage-1-page : page;
|
||||||
|
|
||||||
setcursor(mc, &reading);
|
setcursor(mc, &reading);
|
||||||
|
delayfreeimage(nil);
|
||||||
im = cachedpage(doc, angle, page);
|
im = cachedpage(doc, angle, page);
|
||||||
if(im == nil)
|
if(im == nil)
|
||||||
wexits(0);
|
wexits(0);
|
||||||
|
|
@ -553,8 +565,8 @@ viewer(Document *dd)
|
||||||
wexits("memory");
|
wexits("memory");
|
||||||
}
|
}
|
||||||
resample(im, tmp);
|
resample(im, tmp);
|
||||||
freeimage(im);
|
|
||||||
im = tmp;
|
im = tmp;
|
||||||
|
delayfreeimage(tmp);
|
||||||
setcursor(mc, nil);
|
setcursor(mc, nil);
|
||||||
ul = screen->r.min;
|
ul = screen->r.min;
|
||||||
redraw(screen);
|
redraw(screen);
|
||||||
|
|
@ -578,8 +590,8 @@ viewer(Document *dd)
|
||||||
wexits("memory");
|
wexits("memory");
|
||||||
}
|
}
|
||||||
resample(im, tmp);
|
resample(im, tmp);
|
||||||
freeimage(im);
|
|
||||||
im = tmp;
|
im = tmp;
|
||||||
|
delayfreeimage(tmp);
|
||||||
setcursor(mc, nil);
|
setcursor(mc, nil);
|
||||||
ul = screen->r.min;
|
ul = screen->r.min;
|
||||||
redraw(screen);
|
redraw(screen);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue