diff --git a/TODO b/TODO index 054f5fed48bbec9c90d980433c117a46db1c2ae3..bc90f0e7a020d626e1ab25890e62c16babbb8527 100644 --- a/TODO +++ b/TODO @@ -6,10 +6,6 @@ having to focus it. Have to be a bit careful with this but could be useful. key/option/signal/timeout to totally reload filelist (rescan directories etc) -The "No more slides left in show" bug was fixed, but now there's a rare -condition (viewing a few images, removing them externally while viewing, -then resizing the window) causing imlib2 warnings. - <keypad begin> antialieses the image, but doing that automatically upon key release would be better. However, I couldn't find a way to do that so far. Even when holding down a key, everytime the eventloop runs I get a diff --git a/src/collage.c b/src/collage.c index e76f8ae80cfdb037e96e394dc6aa2a36d65c0979..3e038286826741f104c099c593043d160a536e53 100644 --- a/src/collage.c +++ b/src/collage.c @@ -119,7 +119,6 @@ void init_collage_mode(void) file = FEH_FILE(l->data); if (last) { filelist = feh_file_remove_from_list(filelist, last); - filelist_len--; last = NULL; } D(3, ("About to load image %s\n", file->filename)); diff --git a/src/filelist.c b/src/filelist.c index da17f158a7ebf1bd9c2a4d7fc908f161764f5638..2eb43afacd531091681d69c1cc00ec840fd67984 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -113,6 +113,8 @@ gib_list *feh_file_remove_from_list(gib_list * list, gib_list * l) { D_ENTER(4); feh_file_free(FEH_FILE(l->data)); + D(4, ("filelist_len %d -> %d\n", filelist_len, filelist_len - 1)); + filelist_len--; D_RETURN(4, gib_list_remove(list, l)); } diff --git a/src/index.c b/src/index.c index 5c13d192eb2c86b59f867f8d962f108e2c271a3a..c7c0a84d2d5fe78de12ed438049e5cea1a6bedf5 100644 --- a/src/index.c +++ b/src/index.c @@ -306,7 +306,6 @@ void init_index_mode(void) file = FEH_FILE(l->data); if (last) { filelist = feh_file_remove_from_list(filelist, last); - filelist_len--; last = NULL; } D(4, ("About to load image %s\n", file->filename)); diff --git a/src/slideshow.c b/src/slideshow.c index 1a3ffe8bed404bb9448adf2ed1f8b3e186374c01..314374c6c0546ac9782b68f33037774ee07c1775 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -50,7 +50,6 @@ void init_slideshow_mode(void) file = FEH_FILE(l->data); if (last) { filelist = feh_file_remove_from_list(filelist, last); - filelist_len--; last = NULL; } current_file = l; @@ -128,6 +127,7 @@ void feh_reload_image(winwidget w, int resize, int force_new) winwidget_rename(w, title); free(title); free(new_title); + filelist = feh_file_remove_from_list(filelist, w->file); D_RETURN_(4); } if (force_new) { @@ -244,7 +244,6 @@ void slideshow_change_image(winwidget winwid, int change) if (last) { filelist = feh_file_remove_from_list(filelist, last); - filelist_len--; last = NULL; } s = slideshow_create_name(FEH_FILE(current_file->data)); @@ -268,18 +267,12 @@ void slideshow_change_image(winwidget winwid, int change) } else last = current_file; } - if (!success) { - /* We get here if three files in a row could not be loaded. - * However, it seems that this piece of code is never reached when feh - * would otherwise fail; it's only executed in the aforementioned case, - * causing slideshows to exit although there still are lots of working slides. - * - * So far, there is one known case were we should exit here: - * When viewing a set of files, externally removing all of them and then resizing - * the window in feh, feh will print lots of imlib errors and eventually segfault. - */ - weprintf("No more slides in show?"); - } + if (last) + filelist = feh_file_remove_from_list(filelist, last); + + if (filelist_len == 0) + eprintf("No more slides in show"); + if (opt.slideshow_delay >= 0.0) feh_add_timer(cb_slide_timer, winwid, opt.slideshow_delay, "SLIDE_CHANGE"); D_RETURN_(4); @@ -445,7 +438,6 @@ void feh_filelist_image_remove(winwidget winwid, char do_delete) doomed = current_file; slideshow_change_image(winwid, SLIDE_NEXT); - filelist_len--; if (do_delete) filelist = feh_file_rm_and_free(filelist, doomed); else @@ -460,7 +452,6 @@ void feh_filelist_image_remove(winwidget winwid, char do_delete) free(s); } else if ((winwid->type == WIN_TYPE_SINGLE) || (winwid->type == WIN_TYPE_THUMBNAIL_VIEWER)) { - filelist_len--; if (do_delete) filelist = feh_file_rm_and_free(filelist, winwid->file); else diff --git a/src/thumbnail.c b/src/thumbnail.c index a2246ac00e8d715f24d50677a19972bbf24dca4e..425fa8c5888673643287c30ec7c2bee9d4e2bf43 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -179,7 +179,6 @@ void init_thumbnail_mode(void) file = FEH_FILE(l->data); if (last) { filelist = feh_file_remove_from_list(filelist, last); - filelist_len--; last = NULL; } D(4, ("About to load image %s\n", file->filename));