This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.

View the commit online.

commit 2474de6f94e99c2a6ce0faeacdf757dad20dc6a0
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Thu Jul 13 19:35:10 2023 +0200

    image cache: Avoid negative refcounts
    
    Presumably unintended, obscures things.
---
 src/lib/image.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/lib/image.c b/src/lib/image.c
index 663d22c..b9f601a 100644
--- a/src/lib/image.c
+++ b/src/lib/image.c
@@ -846,22 +846,16 @@ __imlib_GetFrame(ImlibImage * im)
 void
 __imlib_FreeImage(ImlibImage * im)
 {
-   /* if the refcount is positive */
-   if (im->references >= 0)
-     {
-        /* reduce a reference from the count */
-        im->references--;
-        /* if its uncachchable ... */
-        if (IM_FLAG_ISSET(im, F_UNCACHEABLE))
-          {
-             /* and we're down to no references for the image then free it */
-             if (im->references == 0)
-                __imlib_ConsumeImage(im);
-          }
-        /* otherwise clean up our cache if the image becoem 0 ref count */
-        else if (im->references == 0)
-           __imlib_CleanupImageCache();
-     }
+   if (im->references > 0)
+      im->references--;
+
+   if (im->references > 0)
+      return;
+
+   if (IM_FLAG_ISSET(im, F_UNCACHEABLE))
+      __imlib_ConsumeImage(im);
+   else
+      __imlib_CleanupImageCache();
 }
 
 /* dirty and image by settings its invalid flag */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to