eina_lock: remove locks from eina tracking list on free while thread debugging

Summary:
this prevents invalid memory access during subsequent inlist operations

@fix

sq
Depends on D6265

Reviewers: stefan_schmidt, ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6266
This commit is contained in:
Mike Blumenkrantz 2018-06-15 15:38:20 -04:00
parent fb534b328e
commit 66bfc5ff4b
1 changed files with 9 additions and 0 deletions

View File

@ -179,6 +179,15 @@ eina_lock_recursive_new(Eina_Lock *mutex)
static inline void
eina_lock_free(Eina_Lock *mutex)
{
#ifdef EINA_HAVE_DEBUG_THREADS
if (mutex->locked)
{
pthread_mutex_lock(&_eina_tracking_lock);
_eina_tracking = eina_inlist_remove(_eina_tracking,
EINA_INLIST_GET(mutex));
pthread_mutex_unlock(&_eina_tracking_lock);
}
#endif
_eina_lock_free(mutex);
}