diff options
-rw-r--r-- | src/line.cpp | 9 | ||||
-rw-r--r-- | src/line.h | 1 | ||||
-rw-r--r-- | src/phone.cpp | 1 | ||||
-rw-r--r-- | src/sys_settings.cpp | 12 |
4 files changed, 16 insertions, 7 deletions
diff --git a/src/line.cpp b/src/line.cpp index d494262..1eb52b8 100644 --- a/src/line.cpp +++ b/src/line.cpp @@ -39,6 +39,8 @@ t_call_info::t_call_info() { } void t_call_info::clear(void) { + t_mutex_guard g(mutex); + from_uri.set_url(""); from_display.clear(); from_display_override.clear(); @@ -56,6 +58,8 @@ void t_call_info::clear(void) { } string t_call_info::get_from_display_presentation(void) const { + t_mutex_guard g(mutex); + if (from_display_override.empty()) { return from_display; } else { @@ -599,6 +603,7 @@ void t_line::invite(t_phone_user *pu, const t_url &to_uri, const string &to_disp phone_user = pu; t_user *user_config = pu->get_user_profile(); + call_info.mutex.lock(); call_info.from_uri = create_user_uri(); // NOTE: hide_user is not set yet call_info.from_display = user_config->get_display(false); call_info.from_organization = user_config->get_organization(); @@ -607,6 +612,7 @@ void t_line::invite(t_phone_user *pu, const t_url &to_uri, const string &to_disp call_info.to_organization.clear(); call_info.subject = subject; call_info.hdr_referred_by = hdr_referred_by; + call_info.mutex.unlock(); try_to_encrypt = user_config->get_zrtp_enabled(); @@ -1452,6 +1458,7 @@ void t_line::recvd_invite(t_phone_user *pu, t_request *r, t_tid tid, const strin user_config = phone_user->get_user_profile(); user_defined_ringtone = ringtone; + call_info.mutex.lock(); call_info.from_uri = r->hdr_from.uri; call_info.from_display = r->hdr_from.display; call_info.from_display_override = r->hdr_from.display_override; @@ -1464,6 +1471,7 @@ void t_line::recvd_invite(t_phone_user *pu, t_request *r, t_tid tid, const strin call_info.to_display = r->hdr_to.display; call_info.to_organization.clear(); call_info.subject = r->hdr_subject.subject; + call_info.mutex.unlock(); try_to_encrypt = user_config->get_zrtp_enabled(); @@ -2120,6 +2128,7 @@ 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; } @@ -44,6 +44,7 @@ class t_phone; // call state to the user. class t_call_info { public: + mutable t_mutex mutex; t_url from_uri; string from_display; diff --git a/src/phone.cpp b/src/phone.cpp index 77ff53b..d95fee2 100644 --- a/src/phone.cpp +++ b/src/phone.cpp @@ -721,7 +721,6 @@ void t_phone::handle_response_out_of_dialog(StunMessage *r, t_tuid tuid) { } t_phone_user *t_phone::find_phone_user(const string &profile_name) const { - t_rwmutex_reader x(phone_users_mtx); for (list<t_phone_user *>::const_iterator i = phone_users.begin(); i != phone_users.end(); ++i) diff --git a/src/sys_settings.cpp b/src/sys_settings.cpp index 2a669e4..f4f2849 100644 --- a/src/sys_settings.cpp +++ b/src/sys_settings.cpp @@ -195,10 +195,10 @@ t_win_geometry::t_win_geometry(const string &value) { vector<string> v = split(value, ','); if (v.size() == 4) { - x = atoi(v[0].c_str()); - y = atoi(v[1].c_str()); - width = atoi(v[2].c_str()); - height = atoi(v[3].c_str()); + x = std::stoi(v[0]); + y = std::stoi(v[1]); + width = std::stoi(v[2]); + height = std::stoi(v[3]); } } @@ -1126,8 +1126,8 @@ string t_sys_settings::get_product_date(void) const { vector<string> l = split(PRODUCT_DATE, ' '); assert(l.size() == 3); t.tm_mon = str2month_full(l[0]); - t.tm_mday = atoi(l[1].c_str()); - t.tm_year = atoi(l[2].c_str()) - 1900; + t.tm_mday = std::stoi(l[1]); + t.tm_year = std::stoi(l[2]) - 1900; char buf[64]; strftime(buf, 64, "%d %B %Y", &t); |