On Mon, Sep 20, 2010 at 6:06 AM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
>  fix a few segfaults that happened on a specific computer

short explanation of the error, so you can choose to change it or not,
but at least you'll know the reason:

the FILE version will know the data is mmap()ed and thus strings will
not be eina_stringshare_add() or strdup(), instead they will point to
this mmap() area and in turn you cannot eina_stringshare_del() or
free() it.

the STREAM version OTOH does not know about data and will always call
eina_stringshare_add(), so you can do eina_stringshare_del() as you
do.

then now you can choose to leave as STREAM, or just do a simple logic
in your code:

directory = eina_stringshare_add(directory); // do it first, avoid
reference drop to zero!
dict = eet_dictionary_get(ef);
if (!eet_dictionary_string_check(dict, em->config->directory))
    eina_stringshare_del(em->config->directory);
em->config->directory = directory;

And of course, you need to keep eet_file open to have the dictionary
to point to a valid memory location! Otherwise it will generate a
segmentation fault.

I hope it is clear "why" now. Yeah, this may be a bit confusing, but
we tried to write that in eet's documentation... it's the price we pay
for optimizations (makes a huge difference for edje).

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to