On Fri, May 18, 2012 at 10:37 AM, Bluezery <ohpo...@gmail.com> wrote: > 2012/5/18 Vincent Torri <vincent.to...@gmail.com>: >> On Thu, May 17, 2012 at 4:51 PM, Bluezery <ohpo...@gmail.com> wrote: >>> Dear EFL developers, >>> >>> I have questions about initialization/unintialization functions in EFL >>> such as elm_init(), ecore_init(), elm_shutdown(), etc. >>> Those functions have interval static counter variables such as >>> _ecore_init_count. >>> And If xxx_init() is called, a counter variable increases by 1 and if >>> xxx_shutdown() is called, it decreases. >>> However, I think that those confuse users (application developers) somewhat. >>> >>> For example, if ecore_shutdown() is called twice and ecore_init() is >>> called once after that, nothing is initialized. >>> Because after _ecore_init_count variable become 1, ecore_init() do >>> evil_init() or eina_init(), etc. >>> It seems that ecore_init() should be called 3 times after >>> ecore_shutdown() is called twice. All other xxx_init, xxx_shutdown() >>> pairs in EFL do same behavior. >>> IMHO, After ecore_shutdown() is called many times, calling >>> ecore_init() once should do initialization. >>> Of course, If ecore_init() is called 10 times, ecore_shutdown() >>> should do unintialization at the moment ecore_shutdown() is called 11 >>> time. >>> >>> Also return value is somewhat confusing. In documentation of >>> ecore_init() and ecore_shutdown(), It succeed if return value is 1 and >>> it fail if it is 0. >>> But it returns static counter variable. This may need documentation >>> modification in ecore. And other xxx_init() and xxx_shutdown() are >>> better to have same pattern. >>> >> >> It's up to te user to call once the _init function at the beginning of >> the program and the _shutdown() function at the end of the program. >> Any other use is not our problem. The counter is there for indirect >> calls of the init/sutdown functions (like ecore_evas_init that calls >> ecore_init and evas_init for example) >> >> Vincent > > Yes, actually it's a user fault. > But I hope that EFL can handle this user's mistake more user friendly :D
I see only one way to do that. Static analysis with all the knowledge we have about EFL API. This is the kind of issue we can detect with static analysis. We should also be able in some case to detect use of EFL API within thread. In fact, many of this API wrong usage could be detected at compilation time, sadly current C compiler have no way for us to tell them about this restriction. Maybe coccinelle script can handle that, if not then llvm should with a proper new module. Sounds to me like a worth it project, if someone as the time. -- Cedric BAIL ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel