aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-02-25 12:08:12 +0100
committerBert <ber.t@gmx.com>2011-02-25 12:08:12 +0100
commitdafe7eac742301952c088d68a455586b0225a7bd (patch)
tree3a457e0cbd21e274f05df47162504363941c7272 /main.c
parent62fb69b3287addfc5f28db1117b2e314b68e761c (diff)
Refactored imlib context handling
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.c b/main.c
index f6bdb4e..b5e99ec 100644
--- a/main.c
+++ b/main.c
@@ -62,6 +62,7 @@ void cleanup() {
static int in = 0;
if (!in++) {
+ img_close(&img);
img_free(&img);
tns_free(&tns, &win);
win_close(&win);
@@ -71,6 +72,8 @@ void cleanup() {
int load_image() {
struct stat fstats;
+ img_close(&img);
+
if (!stat(filenames[fileidx], &fstats))
filesize = fstats.st_size;
else
@@ -158,7 +161,7 @@ void update_title() {
tns.cnt ? tns.sel + 1 : 0, tns.cnt,
tns.cnt ? filenames[tns.sel] : "");
} else {
- if (img.valid) {
+ if (img.im) {
size = filesize;
size_readable(&size, &unit);
n = snprintf(win_title, TITLE_LEN, "sxiv: [%d/%d] <%d%%> (%.2f%s) %s",
@@ -388,6 +391,7 @@ void on_keypress(XKeyEvent *kev) {
case XK_Return:
if (!tns.thumbs)
tns_init(&tns, filecnt);
+ img_close(&img);
mode = MODE_THUMBS;
win_set_cursor(&win, CURSOR_ARROW);
timo_cursor = 0;