Lock everything that might need to be locked
authorMark Spencer <markster@digium.com>
Mon, 11 Aug 2003 20:47:48 +0000 (20:47 +0000)
committerMark Spencer <markster@digium.com>
Mon, 11 Aug 2003 20:47:48 +0000 (20:47 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1292 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_local.c

index 221b011..3d4511d 100755 (executable)
@@ -131,13 +131,17 @@ static void check_bridge(struct local_pvt *p, int isoutbound)
                /* Masquerade bridged channel into owner */
                /* Lock other side first */
                ast_pthread_mutex_lock(&p->chan->bridge->lock);
+               ast_pthread_mutex_lock(&p->owner->lock);
                ast_channel_masquerade(p->owner, p->chan->bridge);
+               ast_pthread_mutex_unlock(&p->owner->lock);
                ast_pthread_mutex_unlock(&p->chan->bridge->lock);
                p->alreadymasqed = 1;
        } else if (!isoutbound && p->owner && p->owner->bridge && p->chan) {
                /* Masquerade bridged channel into chan */
                ast_pthread_mutex_lock(&p->owner->bridge->lock);
+               ast_pthread_mutex_lock(&p->chan->lock);
                ast_channel_masquerade(p->chan, p->owner->bridge);
+               ast_pthread_mutex_unlock(&p->chan->lock);
                ast_pthread_mutex_unlock(&p->owner->bridge->lock);
                p->alreadymasqed = 1;
        }