diff options
author | Luboš Doležel <lubos@dolezel.info> | 2016-10-05 20:15:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-05 20:15:25 +0200 |
commit | dff38f356445ca6199589a0e122001bae5dc0982 (patch) | |
tree | 27525cfbb26ef93cb3802edc031e332c170fe7b0 /src | |
parent | 4e7ff99f1572f92595d7cedd883582040b1f4cc8 (diff) | |
parent | 2eb954cb34fcb956070896101df4ba78272939fa (diff) | |
download | twinkle-dff38f356445ca6199589a0e122001bae5dc0982.tar twinkle-dff38f356445ca6199589a0e122001bae5dc0982.tar.gz twinkle-dff38f356445ca6199589a0e122001bae5dc0982.tar.lz twinkle-dff38f356445ca6199589a0e122001bae5dc0982.tar.xz twinkle-dff38f356445ca6199589a0e122001bae5dc0982.zip |
Merge pull request #78 from fbriere/issue/73-freeze-on-xfer
Skip over the mutex field when copying t_call_info data
Diffstat (limited to 'src')
-rw-r--r-- | src/line.cpp | 38 | ||||
-rw-r--r-- | src/line.h | 3 |
2 files changed, 40 insertions, 1 deletions
diff --git a/src/line.cpp b/src/line.cpp index 8f6bda4..1c1de17 100644 --- a/src/line.cpp +++ b/src/line.cpp @@ -37,6 +37,43 @@ t_call_info::t_call_info() { clear(); } +t_call_info::t_call_info(const t_call_info& that) { + *this = that; +} + +t_call_info& t_call_info::operator=(const t_call_info& that) { + if (this != &that) { + // FIXME: This may deadlock if "a=b" and "b=a" are run in + // parallel. The proper solution would be to switch + // to std::mutex and call std::lock(this,that). + t_mutex_guard x1(that.mutex); + t_mutex_guard x2(this->mutex); + + from_uri = that.from_uri; + from_display = that.from_display; + + from_display_override = that.from_display_override; + + from_organization = that.from_organization; + to_uri = that.to_uri; + to_display = that.to_display; + to_organization = that.to_organization; + subject = that.subject; + dtmf_supported = that.dtmf_supported; + dtmf_inband = that.dtmf_inband; + dtmf_info = that.dtmf_info; + hdr_referred_by = that.hdr_referred_by; + + last_provisional_reason = that.last_provisional_reason; + + send_codec = that.send_codec; + recv_codec = that.recv_codec; + refer_supported = that.refer_supported; + } + + return *this; +} + void t_call_info::clear(void) { t_mutex_guard g(mutex); @@ -2127,7 +2164,6 @@ void t_line::retry_retrieve_succeeded(void) { } t_call_info t_line::get_call_info(void) const { - t_mutex_guard g(call_info.mutex); return call_info; } @@ -70,6 +70,9 @@ public: bool refer_supported; t_call_info(); + t_call_info(const t_call_info&); + t_call_info& operator=(const t_call_info&); + void clear(void); // Get the from display name to show to the user. |