fix image double-deref/free when not meant to happen
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 15 Apr 2011 07:49:25 +0000 (07:49 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 15 Apr 2011 07:49:25 +0000 (07:49 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@58682 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/cache/evas_cache_image.c

index 5dcbd9b..b9d7eca 100644 (file)
@@ -876,16 +876,15 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
    if (im)
      {
         int ok = 1;
-        
+
         stat_done = 1;
-        if (stat(file, &st) < 0) goto on_stat_error;
-          {
-             if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
-          }
+        if (stat(file, &st) < 0) ok = 0;
+        else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
         if (ok) goto on_ok;
 
         _evas_cache_image_remove_activ(cache, im);
        _evas_cache_image_make_dirty(cache, im);
+        im = NULL;
      }
 
 #ifdef EVAS_FRAME_QUEUING
@@ -902,11 +901,10 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
         if (!stat_done)
           {
              stat_done = 1;
-             if (stat(file, &st) < 0) goto on_stat_error;
-             if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
+             if (stat(file, &st) < 0) ok = 0;
+             else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
           }
-        else
-           if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
+        else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
 
         if (ok)
           {
@@ -914,8 +912,8 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
              _evas_cache_image_make_activ(cache, im, im->cache_key);
              goto on_ok;
           }
-
-        _evas_cache_image_entry_delete(cache, im);
+        _evas_cache_image_make_dirty(cache, im);
+        im = NULL;
      }
 
    if (!stat_done)