summaryrefslogtreecommitdiff
path: root/apps/app_queue.c
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-09-19 09:15:33 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-09-19 09:15:33 -0500
commitc7beb33ebb4f6fe164a144d1e64d0ea533151b36 (patch)
treef82f67aa2348a3ec899a7c89426e5a3624f6376f /apps/app_queue.c
parent16f1598b31f8b777bba304767152af6fbb1b3532 (diff)
parent6409e7b11a2310196a9978b30a6b79e2760be592 (diff)
Merge "app_queue: Crash when transferring" into 13
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r--apps/app_queue.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index c0ee9f35f..e42bfad34 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -5564,6 +5564,10 @@ struct queue_stasis_data {
struct local_optimization caller_optimize;
/*! Local channel optimization details for the member */
struct local_optimization member_optimize;
+ /*! Member channel */
+ struct ast_channel *member_channel;
+ /*! Caller channel */
+ struct ast_channel *caller_channel;
};
/*!
@@ -5581,6 +5585,9 @@ static void queue_stasis_data_destructor(void *obj)
ao2_cleanup(queue_data->member);
queue_unref(queue_data->queue);
ast_string_field_free_memory(queue_data);
+
+ ao2_ref(queue_data->member_channel, -1);
+ ao2_ref(queue_data->caller_channel, -1);
}
/*!
@@ -5627,6 +5634,16 @@ static struct queue_stasis_data *queue_stasis_data_alloc(struct queue_ent *qe,
queue_data->caller_pos = qe->opos;
ao2_ref(mem, +1);
queue_data->member = mem;
+
+ /*
+ * During transfers it's possible for both the member and/or caller
+ * channel(s) to not be available. Adding a reference here ensures
+ * that the channels remain until app_queue is completely done with
+ * them.
+ */
+ queue_data->member_channel = ao2_bump(peer);
+ queue_data->caller_channel = ao2_bump(qe->chan);
+
return queue_data;
}