diff --git a/src/imlib.c b/src/imlib.c index 0accbdc8..7ee447e0 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -507,7 +507,7 @@ void feh_reload_image(winwidget w, int resize, int force_new) * the new image cannot be loaded, so we must not free the old image yet. */ if (force_new) - winwidget_free_image(w); + winwidget_free_image_and_decache(w); // if it's an external image, our own cache will also get in your way char *sfn; diff --git a/src/signals.c b/src/signals.c index a64f9352..e0133abd 100644 --- a/src/signals.c +++ b/src/signals.c @@ -101,7 +101,7 @@ void feh_handle_signal(int signo) else if (signo == SIGUSR2) slideshow_change_image(winwid, SLIDE_PREV, 1); } else { - feh_reload_image(winwid, 0, 0); + feh_reload_image(winwid, 0, 1); } } else if (opt.multiwindow) { for (i = window_num - 1; i >= 0; i--) diff --git a/src/winwidget.c b/src/winwidget.c index 9f61ba6d..61e6687e 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -783,7 +783,7 @@ void feh_event_handle_inotify(void) } else if (event->mask & (IN_CLOSE_WRITE | IN_MOVED_TO)) { if (strcmp(event->name, FEH_FILE(windows[j]->file->data)->name) == 0) { D(("inotify says file changed\n")); - feh_reload_image(windows[j], 0, 0); + feh_reload_image(windows[j], 0, 1); } } break; @@ -1059,6 +1059,15 @@ void winwidget_free_image(winwidget w) return; } +void winwidget_free_image_and_decache(winwidget w) +{ + if (w->im) { + gib_imlib_free_image_and_decache(w->im); + } + w->im = NULL; + winwidget_free_image(w); +} + void feh_debug_print_winwid(winwidget w) { printf("winwid_debug:\n" "winwid = %p\n" "win = %ld\n" "w = %d\n" diff --git a/src/winwidget.h b/src/winwidget.h index 9d742864..f7a73985 100644 --- a/src/winwidget.h +++ b/src/winwidget.h @@ -133,6 +133,7 @@ void winwidget_show_menu(winwidget winwid); void winwidget_hide(winwidget winwid); void winwidget_destroy_all(void); void winwidget_free_image(winwidget w); +void winwidget_free_image_and_decache(winwidget w); void winwidget_center_image(winwidget w); void winwidget_render_image(winwidget winwid, int resize, int force_alias); void winwidget_rotate_image(winwidget winid, double angle);