1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Update: Run type_get_interfacecb() in unlocked state (guarded by ref) so it can call igloo_ro_ref()

This commit is contained in:
Philipp Schafft 2019-09-12 09:33:25 +00:00
parent 76a9d1c756
commit b59963aa25

View File

@ -387,8 +387,23 @@ igloo_ro_t igloo_ro_get_interface(igloo_ro_t self, const igloo_ro_type_t *type,
igloo_thread_mutex_unlock(&(base->lock));
return igloo_RO_NULL;
}
/* create a temp reference
* This is required so we can run type_get_interfacecb() in unlocked state.
*/
base->refc++;
igloo_thread_mutex_unlock(&(base->lock));
if (base->type->type_get_interfacecb)
ret = base->type->type_get_interfacecb(self, type, name, associated);
igloo_thread_mutex_lock(&(base->lock));
/* remove temp reference
* If refc == 0 the application has a bug.
* TODO: We must tell someone about it.
* Anyway, we can not just set refc = -1, that will just break things more.
*/
if (base->refc)
base->refc--;
igloo_thread_mutex_unlock(&(base->lock));
return ret;