aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/page
diff options
context:
space:
mode:
authorFazlul Shahriar <fshahriar@gmail.com>2009-08-15 02:34:42 -0400
committerFazlul Shahriar <fshahriar@gmail.com>2009-08-15 02:34:42 -0400
commit94349f64d16ed2159cc944a2af7a3fcaedd9c9d9 (patch)
treea5059e9cccb2f527db179ce03d0cbb9d9afc460d /src/cmd/page
parentd19fdc056d160a429d046e472287073edec11ea3 (diff)
downloadplan9port-94349f64d16ed2159cc944a2af7a3fcaedd9c9d9.tar.gz
plan9port-94349f64d16ed2159cc944a2af7a3fcaedd9c9d9.tar.bz2
plan9port-94349f64d16ed2159cc944a2af7a3fcaedd9c9d9.zip
page: add missing delayfreeimage calls
fixes #19 http://code.swtch.com/plan9port/issue/19 http://codereview.appspot.com/108041
Diffstat (limited to 'src/cmd/page')
-rw-r--r--src/cmd/page/view.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/cmd/page/view.c b/src/cmd/page/view.c
index c59a0edb..e9378dc6 100644
--- a/src/cmd/page/view.c
+++ b/src/cmd/page/view.c
@@ -18,6 +18,7 @@
Document *doc;
Mousectl *mc;
Image *im;
+Image *tofree;
int page;
int angle = 0;
int showbottom = 0; /* on the next showpage, move the image so the bottom is visible. */
@@ -62,6 +63,16 @@ enum {
RMenu = 3,
};
+static void
+delayfreeimage(Image *m)
+{
+ if(m == tofree)
+ return;
+ if(tofree)
+ freeimage(tofree);
+ tofree = m;
+}
+
void
unhide(void)
{
@@ -121,6 +132,7 @@ showpage(int page, Menu *m)
m->lasthit = reverse ? doc->npage-1-page : page;
setcursor(mc, &reading);
+ delayfreeimage(nil);
im = cachedpage(doc, angle, page);
if(im == nil)
wexits(0);
@@ -553,8 +565,8 @@ viewer(Document *dd)
wexits("memory");
}
resample(im, tmp);
- freeimage(im);
im = tmp;
+ delayfreeimage(tmp);
setcursor(mc, nil);
ul = screen->r.min;
redraw(screen);
@@ -578,8 +590,8 @@ viewer(Document *dd)
wexits("memory");
}
resample(im, tmp);
- freeimage(im);
im = tmp;
+ delayfreeimage(tmp);
setcursor(mc, nil);
ul = screen->r.min;
redraw(screen);