summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-08-05 18:51:36 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-08-05 18:59:33 +0100
commit21efff6d3eded1dc3e6c46ac6e7ce7b89f227940 (patch)
tree937c734369b1eefb0f41475019291e85f55b2445
parentc56791180d4860d710dfe89d2c568ab65bd3fef2 (diff)
evas image - eina file - be paranoud about double closes
tracking some seemingly not so good asan hits on the eina file where we're accessing an eina file already closed... so be extra paranoid about it and set things to null after free/close...
Diffstat (limited to '')
-rw-r--r--src/lib/evas/cache/evas_cache_image.c6
-rw-r--r--src/lib/evas/canvas/evas_object_image.c32
-rw-r--r--src/lib/evas/common/evas_image_main.c6
-rw-r--r--src/modules/evas/image_loaders/dds/evas_image_load_dds.c2
4 files changed, 39 insertions, 7 deletions
diff --git a/src/lib/evas/cache/evas_cache_image.c b/src/lib/evas/cache/evas_cache_image.c
index 593f801efc..ae84db4491 100644
--- a/src/lib/evas/cache/evas_cache_image.c
+++ b/src/lib/evas/cache/evas_cache_image.c
@@ -181,7 +181,11 @@ _evas_cache_image_entry_delete(Evas_Cache_Image *cache, Image_Entry *ie)
181 FREESTRC(ie->cache_key); 181 FREESTRC(ie->cache_key);
182 FREESTRC(ie->file); 182 FREESTRC(ie->file);
183 FREESTRC(ie->key); 183 FREESTRC(ie->key);
184 if (ie->f && ie->flags.given_mmap) eina_file_close(ie->f); 184 if (ie->f && ie->flags.given_mmap)
185 {
186 eina_file_close(ie->f);
187 ie->f = NULL;
188 }
185 ie->cache = NULL; 189 ie->cache = NULL;
186 if ((cache) && (cache->func.surface_delete)) cache->func.surface_delete(ie); 190 if ((cache) && (cache->func.surface_delete)) cache->func.surface_delete(ie);
187 191
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 0f2c10aa10..abcfa1729b 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -1711,10 +1711,34 @@ evas_object_image_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
1711 Eina_Rectangle *r; 1711 Eina_Rectangle *r;
1712 1712
1713 /* free obj */ 1713 /* free obj */
1714 eina_file_close(o->cur->f); 1714 if (o->cur->key)
1715 if (o->cur->key) eina_stringshare_del(o->cur->key); 1715 {
1716 if (o->cur->source) _evas_image_proxy_unset(eo_obj, obj, o); 1716 eina_stringshare_del(o->cur->key);
1717 if (o->cur->scene) _evas_image_3d_unset(eo_obj, obj, o); 1717 EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
1718 state_write->key = NULL;
1719 EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
1720 }
1721 if (o->cur->source)
1722 {
1723 if (o->cur->source) _evas_image_proxy_unset(eo_obj, obj, o);
1724 EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
1725 state_write->source = NULL;
1726 EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
1727 }
1728 if (o->cur->scene)
1729 {
1730 if (o->cur->scene) _evas_image_3d_unset(eo_obj, obj, o);
1731 EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
1732 state_write->scene = NULL;
1733 EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
1734 }
1735 if (o->cur->f)
1736 {
1737 eina_file_close(o->cur->f);
1738 EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
1739 state_write->f = NULL;
1740 EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
1741 }
1718 if (obj->layer && obj->layer->evas) 1742 if (obj->layer && obj->layer->evas)
1719 { 1743 {
1720 if (o->engine_data && ENC) 1744 if (o->engine_data && ENC)
diff --git a/src/lib/evas/common/evas_image_main.c b/src/lib/evas/common/evas_image_main.c
index a9cee630aa..e42e05d816 100644
--- a/src/lib/evas/common/evas_image_main.c
+++ b/src/lib/evas/common/evas_image_main.c
@@ -518,7 +518,11 @@ _evas_common_rgba_image_delete(Image_Entry *ie)
518 free(frame); 518 free(frame);
519 } 519 }
520 } 520 }
521 if (ie->f && !ie->flags.given_mmap) eina_file_close(ie->f); 521 if (ie->f && !ie->flags.given_mmap)
522 {
523 eina_file_close(ie->f);
524 ie->f = NULL;
525 }
522 eina_freeq_ptr_add(eina_freeq_main_get(), im, free, sizeof(*im)); 526 eina_freeq_ptr_add(eina_freeq_main_get(), im, free, sizeof(*im));
523} 527}
524 528
diff --git a/src/modules/evas/image_loaders/dds/evas_image_load_dds.c b/src/modules/evas/image_loaders/dds/evas_image_load_dds.c
index e77c3e960b..d24707c9ae 100644
--- a/src/modules/evas/image_loaders/dds/evas_image_load_dds.c
+++ b/src/modules/evas/image_loaders/dds/evas_image_load_dds.c
@@ -145,7 +145,7 @@ evas_image_load_file_close_dds(void *loader_data)
145{ 145{
146 Evas_Loader_Internal *loader = loader_data; 146 Evas_Loader_Internal *loader = loader_data;
147 147
148 eina_file_close(loader->f); 148 if (loader->f) eina_file_close(loader->f);
149 free(loader); 149 free(loader);
150} 150}
151 151