From 2e60ab67d1789609f1e7eef11aaebfa9eb440a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= Date: Sun, 29 Sep 2019 20:53:09 -0400 Subject: Remove duplicate mutex lock in `t_phone::end_call()` A write lock on `lines_mtx` has already been acquired at the beginning of `end_call()`. --- src/phone.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/phone.cpp b/src/phone.cpp index 16abc38..8de3834 100644 --- a/src/phone.cpp +++ b/src/phone.cpp @@ -279,8 +279,6 @@ void t_phone::end_call(void) { move_line_to_background(lineno1); move_line_to_background(lineno2); } else { - t_rwmutex_reader x(lines_mtx); - // Hangup the active line, and make the next // line active. int l = active_line; -- cgit v1.2.3 From 79cc23508006d61172522f4b12db8261e760768b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= Date: Sun, 29 Sep 2019 20:20:02 -0400 Subject: Make `t_phone::mutex_3way` recursive to avoid a deadlock `t_phone::mutex_3way` can be locked twice when hanging up a conference call: - `t_phone::cleanup_3way_state()` acquires a lock - `t_audio_session::stop_3way()` is called - `t_audio_session::get_peer_3way()` is called - `t_phone::get_3way_peer_line()` is called - which acquires another lock Making that mutex recursive is a simple way to work around this issue. --- src/phone.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phone.h b/src/phone.h index f9c18d8..771db3b 100644 --- a/src/phone.h +++ b/src/phone.h @@ -130,7 +130,7 @@ private: bool is_3way; // indicates an acitive 3-way t_line *line1_3way; // first line in 3-way conf t_line *line2_3way; // second line in 3-way conf - mutable t_mutex mutex_3way; + mutable t_recursive_mutex mutex_3way; // Call transfer data. When a REFER comes in, the user has // to give permission before the triggered INVITE can be sent. -- cgit v1.2.3