Commit 8b79bc33 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

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.
parent 232302e9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ 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>

+1 −1
Original line number Diff line number Diff line
@@ -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, 0);
			feh_reload_image(winwid, 0);
	} else if (ev->xbutton.button == opt.prev_button) {
		D(("Prev Button Press event\n"));
		if ((winwid != NULL)
+1 −1
Original line number Diff line number Diff line
@@ -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, int force_new);
void feh_reload_image(winwidget w, int resize);
void feh_filelist_image_remove(winwidget winwid, char do_delete);
void slideshow_save_image(winwidget win);
void feh_edit_inplace(winwidget w, int orientation);
+2 −2
Original line number Diff line number Diff line
@@ -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, 1);
		feh_reload_image(w, 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, 1);
		feh_reload_image(w, 1);
	} else {
		im_weprintf(w, "failed to load image from disk to edit it in place");
	}
+3 −3
Original line number Diff line number Diff line
@@ -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, 1);
				feh_reload_image(winwid, 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, 1);
				feh_reload_image(winwid, 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, 0);
		feh_reload_image(winwid, 0);
	}
	else if (feh_is_kp(&keys.toggle_pause, keysym, state)) {
		slideshow_pause_toggle(winwid);
Loading