rendered paste bodyIndex: corelib/channel.c
===================================================================
--- corelib/channel.c (revision 1088)
+++ corelib/channel.c (working copy)
@@ -631,6 +631,11 @@
{
struct opbx_frame f = { OPBX_FRAME_CONTROL, OPBX_CONTROL_HANGUP };
chan->_softhangup |= OPBX_SOFTHANGUP_DEV;
+ /* Yeah, let's not change a lock-critical value without locking */
+ if (!opbx_mutex_trylock(&chan->lock)) {
+ chan->_softhangup |= OPBX_SOFTHANGUP_DEV;
+ opbx_mutex_unlock(&chan->lock);
+ }
return opbx_queue_frame(chan, &f);
}