Git Product home page Git Product logo

Comments (2)

livibetter avatar livibetter commented on July 1, 2024
diff --git a/src/feh.h b/src/feh.h
index 63aeef6..6da9f5f 100644
--- a/src/feh.h
+++ b/src/feh.h
@@ -118,7 +118,9 @@ void init_unloadables_mode(void);
 void feh_clean_exit(void);
 int feh_load_image(Imlib_Image * im, feh_file * file);
 void show_mini_usage(void);
-void slideshow_change_image(winwidget winwid, int change);
+#define slideshow_change_image(winwid, change) \
+       _slideshow_change_image(winwid, change, 1)
+void _slideshow_change_image(winwidget winwid, int change, int render);
 void slideshow_pause_toggle(winwidget w);
 char *slideshow_create_name(feh_file * file);
 void init_keyevents(void);
diff --git a/src/slideshow.c b/src/slideshow.c
index 6d39d2c..39ae81f 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -170,7 +170,7 @@ void feh_reload_image(winwidget w, int resize, int force_new)
    return;
 }

-void slideshow_change_image(winwidget winwid, int change)
+void _slideshow_change_image(winwidget winwid, int change, int render)
 {
    int success = 0;
    gib_list *last = NULL;
@@ -262,7 +262,8 @@ void slideshow_change_image(winwidget winwid, int change)
            winwidget_reset_image(winwid);
            winwid->im_w = gib_imlib_image_get_width(winwid->im);
            winwid->im_h = gib_imlib_image_get_height(winwid->im);
-           winwidget_render_image(winwid, 1, 0);
+           if (render)
+               winwidget_render_image(winwid, 1, 0);

            s = slideshow_create_name(FEH_FILE(current_file->data));
            winwidget_rename(winwid, s);
@@ -430,7 +431,7 @@ void feh_filelist_image_remove(winwidget winwid, char do_delete)
        gib_list *doomed;

        doomed = current_file;
-       slideshow_change_image(winwid, SLIDE_NEXT);
+       _slideshow_change_image(winwid, SLIDE_NEXT, 0);
        if (do_delete)
            filelist = feh_file_rm_and_free(filelist, doomed);
        else
@@ -440,9 +441,7 @@ void feh_filelist_image_remove(winwidget winwid, char do_delete)
            winwidget_destroy(winwid);
            return;
        }
-       s = slideshow_create_name(FEH_FILE(winwid->file->data));
-       winwidget_rename(winwid, s);
-       free(s);
+       winwidget_render_image(winwid, 1, 0);
    } else if ((winwid->type == WIN_TYPE_SINGLE)
           || (winwid->type == WIN_TYPE_THUMBNAIL_VIEWER)) {
        if (do_delete)

The cause is slideshow_change_image() is called before the image removed from the filelist and that function also makes call to render the image, so it still operates on soon-to-be-old filelist.

I am not sure if it's really need that function to assign a new current image before/after the current image removed. But that function seems to do some work, so I just added render and wrapped it up with a #define.

from feh.

derf avatar derf commented on July 1, 2024

Yeah, that's the best solution. I prefer changing all function calls over building #define mazes, though ;-)

Fixed in 64e9c95

from feh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.