diff --git a/main/pbx.c b/main/pbx.c index 1d4ea02..3fc8456 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -4283,6 +4283,7 @@ static int handle_statechange(void *datap) /* Device state changed since last check - notify the watchers */ + ast_rdlock_contexts(); ao2_lock(hints); ao2_lock(hint); @@ -4290,6 +4291,7 @@ static int handle_statechange(void *datap) /* the extension has been destroyed */ ao2_unlock(hint); ao2_unlock(hints); + ast_unlock_contexts(); continue; } @@ -4310,6 +4312,7 @@ static int handle_statechange(void *datap) hint->laststate = state; /* record we saw the change */ ao2_unlock(hint); ao2_unlock(hints); + ast_unlock_contexts(); } ao2_iterator_destroy(&i); ast_free(str);