Ecore: Fix invalid lock count if DEBUG is enabled

With -DDEBUG, we can see an error message, like:
ERR: You are calling _ecore_lock() from outside of the main loop
     threads in lib/ecore/ecore_private at line 306

Looking at the code shows that ecore_lock fails immediately if
thread debugging is enabled, but ecore_unlock does not, so the
value _ecore_main_lock_count could go below 0.

This is not very important as the value is never used.
This commit is contained in:
Jean-Philippe Andre 2015-07-28 15:49:47 +09:00
parent fbd0a51607
commit a1a1a93175
1 changed files with 4 additions and 0 deletions

View File

@ -312,6 +312,10 @@ _ecore_lock(void)
static inline void
_ecore_unlock(void)
{
#ifndef HAVE_THREAD_SAFETY
/* see _ecore_lock(); no-op unless EINA_HAVE_DEBUG_THREADS is defined */
EINA_MAIN_LOOP_CHECK_RETURN;
#endif
_ecore_main_lock_count--;
/* assert(_ecore_main_lock_count == 0); */
#ifdef HAVE_THREAD_SAFETY