Skip to content

Commit

Permalink
Fix logout segfault (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingster authored Oct 30, 2020
1 parent 83b6b1a commit 6616d3c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tinyphone/phone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,17 @@ namespace tp {
}

void TinyPhone::Logout(SIPAccount* acc) throw(pj::Error) {
try {
acc->UnRegister();
}
catch (Error& err) {
PJ_LOG(1, (__FILENAME__, "Logout Account UnRegister Error %s", err.reason.c_str()));
synchronized(add_acc_mutex) {
try {
acc->UnRegister();
}
catch (Error& err) {
PJ_LOG(1, (__FILENAME__, "Logout Account UnRegister Error %s", err.reason.c_str()));
}
accounts.erase(acc->Name());
delete (acc);
SaveAccounts();
}
delete (acc);
accounts.erase(acc->Name());
SaveAccounts();
}

int TinyPhone::Logout() throw(pj::Error) {
Expand Down

0 comments on commit 6616d3c

Please sign in to comment.