summaryrefslogtreecommitdiff
path: root/src/slideshow.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-08-31 16:51:58 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-08-31 16:58:11 +0200
commit8b79bc33f37db12cbb672bdb47dcfeb0f2030bce (patch)
tree7fe42adc6685cdc4da86cad0e24a47ce035e1290 /src/slideshow.c
parent232302e9b8e81fe7c712d3659164dea3d007b0fe (diff)
feh_reload_image: Always die if reload failed
This fixes a segfault in --reload when the image becomes unloadable while feh is running. Note that this does not affect --reload with more than one file: If the current image is removed, feh will simply jump to the next image. feh will only quit if the file still exists, but can no longer be loaded.
Diffstat (limited to 'src/slideshow.c')
-rw-r--r--src/slideshow.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/slideshow.c b/src/slideshow.c
index ba9e028..22d2124 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, 0);
+ feh_reload_image(w, 1);
feh_add_unique_timer(cb_reload_timer, w, opt.reload);
return;
}
-void feh_reload_image(winwidget w, int resize, int force_new)
+void feh_reload_image(winwidget w, int resize)
{
char *title, *new_title;
int len;
@@ -152,7 +152,7 @@ void feh_reload_image(winwidget w, int resize, int force_new)
return;
}
- D(("resize %d, force_new %d\n", resize, force_new));
+ D(("resize %d\n", resize));
free(FEH_FILE(w->file->data)->caption);
FEH_FILE(w->file->data)->caption = NULL;
@@ -169,20 +169,10 @@ void feh_reload_image(winwidget w, int resize, int force_new)
/* force imlib2 not to cache */
winwidget_free_image(w);
- /* 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 ((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 (!resize && ((old_w != gib_imlib_image_get_width(tmp)) ||
(old_h != gib_imlib_image_get_height(tmp))))
resize = 1;