cedric pushed a commit to branch master.
commit 2b68a3125227a7a8acbe20b2cb4e094a302e875e
Author: Cedric Bail <[email protected]>
Date: Mon Aug 12 12:12:13 2013 +0900
evas: handle gracefully move from evas_object_image_file_set to and from
evas_object_image_mmap_set.
---
src/lib/evas/canvas/evas_object_image.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/lib/evas/canvas/evas_object_image.c
b/src/lib/evas/canvas/evas_object_image.c
index da160cd..5cfeda6 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -392,8 +392,24 @@ _image_init_set(Eina_File *f, const char *file, const char
*key,
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
{
- if (f) state_write->u.f = f;
- else eina_stringshare_replace(&state_write->u.file, file);
+ if (f)
+ {
+ if (!state_write->mmaped_source)
+ eina_stringshare_del(state_write->u.file);
+ else if (state_write->u.f)
+ eina_file_close(state_write->u.f);
+ state_write->u.f = eina_file_dup(f);
+ }
+ else
+ {
+ if (!state_write->mmaped_source)
+ eina_stringshare_replace(&state_write->u.file, file);
+ else
+ {
+ if (state_write->u.f) eina_file_close(state_write->u.f);
+ state_write->u.file = eina_stringshare_add(file);
+ }
+ }
state_write->mmaped_source = !!f;
eina_stringshare_replace(&state_write->key, key);
}
@@ -3548,7 +3564,14 @@ evas_object_image_free(Evas_Object *eo_obj,
Evas_Object_Protected_Data *obj)
Eina_Rectangle *r;
/* free obj */
- if (o->cur->u.file && !o->cur->mmaped_source)
eina_stringshare_del(o->cur->u.file);
+ if (!o->cur->mmaped_source)
+ {
+ if (o->cur->u.file) eina_stringshare_del(o->cur->u.file);
+ }
+ else
+ {
+ if (o->cur->u.f) eina_file_close(o->cur->u.f);
+ }
if (o->cur->key) eina_stringshare_del(o->cur->key);
if (o->cur->source) _proxy_unset(eo_obj, obj, o);
if (obj->layer && obj->layer->evas)
--
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk