summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-09-01 11:29:47 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-09-01 11:29:47 +0200
commit910e2e3d219626be260f17bbdc0a113d04037387 (patch)
tree6024bc0e413a513bc30b6de8a756971d3c4c7b6f
parentfb591037342927d25dfab887fbeff0c1671d0288 (diff)
downloadfeh-910e2e3d219626be260f17bbdc0a113d04037387.zip
Revert "feh_reload_image: Always die if reload failed"
This reverts commit 8b79bc33f37db12cbb672bdb47dcfeb0f2030bce.
-rw-r--r--ChangeLog1
-rw-r--r--src/events.c2
-rw-r--r--src/feh.h2
-rw-r--r--src/imlib.c4
-rw-r--r--src/keyevents.c6
-rw-r--r--src/menu.c2
-rw-r--r--src/signals.c2
-rw-r--r--src/slideshow.c22
-rw-r--r--src/thumbnail.c2
9 files changed, 26 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 1370523..f74415a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,7 +9,6 @@ git HEAD
* The --filelist option now supports /dev/stdin (or "-" as shortcut)
* Several Xinerama fixes, only --fullscreen on screen != 0 is still broken
<https://github.com/derf/feh/issues/5>
- * Fix segfault when trying to reload an image which is no longer loadable
Tue, 16 Aug 2011 22:48:06 +0200 Daniel Friesel <derf@finalrewind.org>
diff --git a/src/events.c b/src/events.c
index 68f8c11..96408e1 100644
--- a/src/events.c
+++ b/src/events.c
@@ -127,7 +127,7 @@ static void feh_event_handle_ButtonPress(XEvent * ev)
} else if (ev->xbutton.button == opt.reload_button) {
D(("Reload Button Press event\n"));
if (winwid != NULL)
- feh_reload_image(winwid, 0);
+ feh_reload_image(winwid, 0, 0);
} else if (ev->xbutton.button == opt.prev_button) {
D(("Prev Button Press event\n"));
if ((winwid != NULL)
diff --git a/src/feh.h b/src/feh.h
index c1ca034..6604f66 100644
--- a/src/feh.h
+++ b/src/feh.h
@@ -146,7 +146,7 @@ void feh_draw_info(winwidget w);
void feh_draw_errstr(winwidget w);
void feh_display_status(char stat);
void real_loadables_mode(int loadable);
-void feh_reload_image(winwidget w, int resize);
+void feh_reload_image(winwidget w, int resize, int force_new);
void feh_filelist_image_remove(winwidget winwid, char do_delete);
void slideshow_save_image(winwidget win);
void feh_edit_inplace(winwidget w, int orientation);
diff --git a/src/imlib.c b/src/imlib.c
index ed3fc12..47031bd 100644
--- a/src/imlib.c
+++ b/src/imlib.c
@@ -801,7 +801,7 @@ void feh_edit_inplace(winwidget w, int op)
if (!strcmp(gib_imlib_image_format(w->im), "jpeg")) {
feh_edit_inplace_lossless(w, op);
- feh_reload_image(w, 1);
+ feh_reload_image(w, 1, 1);
return;
}
@@ -817,7 +817,7 @@ void feh_edit_inplace(winwidget w, int op)
gib_imlib_image_orientate(old, op);
gib_imlib_save_image(old, FEH_FILE(w->file->data)->filename);
gib_imlib_free_image(old);
- feh_reload_image(w, 1);
+ feh_reload_image(w, 1, 1);
} else {
im_weprintf(w, "failed to load image from disk to edit it in place");
}
diff --git a/src/keyevents.c b/src/keyevents.c
index 8e6e3f6..60663db 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -333,7 +333,7 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action)
feh_action_run(FEH_FILE(winwid->file->data), opt.actions[action]);
if (opt.hold_actions[action])
- feh_reload_image(winwid, 1);
+ feh_reload_image(winwid, 1, 1);
else
slideshow_change_image(winwid, SLIDE_NEXT, 1);
@@ -342,7 +342,7 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action)
feh_action_run(FEH_FILE(winwid->file->data), opt.actions[action]);
if (opt.hold_actions[action])
- feh_reload_image(winwid, 1);
+ feh_reload_image(winwid, 1, 1);
else
winwidget_destroy(winwid);
} else if (winwid->type == WIN_TYPE_THUMBNAIL)
@@ -630,7 +630,7 @@ void feh_event_handle_keypress(XEvent * ev)
winwidget_render_image(winwid, 0, 0);
}
else if (feh_is_kp(&keys.reload_image, keysym, state)) {
- feh_reload_image(winwid, 0);
+ feh_reload_image(winwid, 0, 0);
}
else if (feh_is_kp(&keys.toggle_pause, keysym, state)) {
slideshow_pause_toggle(winwid);
diff --git a/src/menu.c b/src/menu.c
index 4a2c38f..16e1c77 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1302,7 +1302,7 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, void *data)
winwidget_render_image(m->fehwin, 1, 0);
break;
case CB_RELOAD:
- feh_reload_image(m->fehwin, 0);
+ feh_reload_image(m->fehwin, 0, 0);
break;
case CB_REMOVE:
feh_filelist_image_remove(m->fehwin, 0);
diff --git a/src/signals.c b/src/signals.c
index 01cdf72..d5a6899 100644
--- a/src/signals.c
+++ b/src/signals.c
@@ -70,7 +70,7 @@ void feh_handle_signal(int signo)
slideshow_change_image(winwid, SLIDE_PREV, 1);
} else if (opt.multiwindow) {
for (i = window_num - 1; i >= 0; i--)
- feh_reload_image(windows[i], 0);
+ feh_reload_image(windows[i], 0, 0);
}
return;
diff --git a/src/slideshow.c b/src/slideshow.c
index 22d2124..ba9e028 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -135,12 +135,12 @@ void cb_reload_timer(void *data)
winwidget_rename(w, current_filename);
free(current_filename);
- feh_reload_image(w, 1);
+ feh_reload_image(w, 1, 0);
feh_add_unique_timer(cb_reload_timer, w, opt.reload);
return;
}
-void feh_reload_image(winwidget w, int resize)
+void feh_reload_image(winwidget w, int resize, int force_new)
{
char *title, *new_title;
int len;
@@ -152,7 +152,7 @@ void feh_reload_image(winwidget w, int resize)
return;
}
- D(("resize %d\n", resize));
+ D(("resize %d, force_new %d\n", resize, force_new));
free(FEH_FILE(w->file->data)->caption);
FEH_FILE(w->file->data)->caption = NULL;
@@ -169,10 +169,20 @@ void feh_reload_image(winwidget w, int resize)
/* force imlib2 not to cache */
winwidget_free_image(w);
- if ((feh_load_image(&tmp, FEH_FILE(w->file->data))) == 0)
- eprintf("failed to reload image");
-
/* if the image has changed in dimensions - we gotta resize */
+ if ((feh_load_image(&tmp, FEH_FILE(w->file->data))) == 0) {
+ if (force_new) {
+ eprintf("failed to reload image\n");
+ } else {
+ im_weprintf(w, "Couldn't reload image. Is it still there?");
+ }
+ winwidget_rename(w, title);
+ free(title);
+ free(new_title);
+ filelist = feh_file_remove_from_list(filelist, w->file);
+ return;
+ }
+
if (!resize && ((old_w != gib_imlib_image_get_width(tmp)) ||
(old_h != gib_imlib_image_get_height(tmp))))
resize = 1;
diff --git a/src/thumbnail.c b/src/thumbnail.c
index 9053649..ee8b101 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -922,7 +922,7 @@ void feh_thumbnail_show_fullsize(feh_file *thumbfile)
free(thumbwin->file);
thumbwin->file = gib_list_add_front(NULL, thumbfile);
winwidget_rename(thumbwin, s);
- feh_reload_image(thumbwin, 1);
+ feh_reload_image(thumbwin, 1, 0);
}
}