Fix being call after removing the account: do not remove auth info before the account has been correctly removed (unREGISTER sent)
This commit is contained in:
parent
3e57429534
commit
d74ccc32bd
2 changed files with 22 additions and 12 deletions
|
|
@ -128,10 +128,14 @@ bool AccountManager::login(QString username,
|
||||||
const std::string &message) {
|
const std::string &message) {
|
||||||
if (mAccountModel && account == mAccountModel->getAccount()) {
|
if (mAccountModel && account == mAccountModel->getAccount()) {
|
||||||
if (state == linphone::RegistrationState::Failed) {
|
if (state == linphone::RegistrationState::Failed) {
|
||||||
core->removeAuthInfo(authInfo);
|
connect(
|
||||||
core->removeAccount(account);
|
mAccountModel.get(), &AccountModel::removed, this,
|
||||||
|
[this]() {
|
||||||
emit mAccountModel->removeListener();
|
emit mAccountModel->removeListener();
|
||||||
mAccountModel = nullptr;
|
mAccountModel = nullptr;
|
||||||
|
},
|
||||||
|
Qt::SingleShotConnection);
|
||||||
|
mAccountModel->removeAccount();
|
||||||
} else if (state == linphone::RegistrationState::Ok) {
|
} else if (state == linphone::RegistrationState::Ok) {
|
||||||
core->setDefaultAccount(account);
|
core->setDefaultAccount(account);
|
||||||
emit mAccountModel->removeListener();
|
emit mAccountModel->removeListener();
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,15 @@ AccountModel::~AccountModel() {
|
||||||
void AccountModel::onRegistrationStateChanged(const std::shared_ptr<linphone::Account> &account,
|
void AccountModel::onRegistrationStateChanged(const std::shared_ptr<linphone::Account> &account,
|
||||||
linphone::RegistrationState state,
|
linphone::RegistrationState state,
|
||||||
const std::string &message) {
|
const std::string &message) {
|
||||||
|
if (state == linphone::RegistrationState::Cleared) {
|
||||||
|
qDebug() << log().arg("Account removed");
|
||||||
|
auto authInfo = mMonitor->findAuthInfo();
|
||||||
|
if (authInfo) {
|
||||||
|
CoreModel::getInstance()->getCore()->removeAuthInfo(authInfo);
|
||||||
|
}
|
||||||
|
removeUserData(mMonitor);
|
||||||
|
emit removed();
|
||||||
|
}
|
||||||
emit registrationStateChanged(account, state, message);
|
emit registrationStateChanged(account, state, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,13 +117,10 @@ void AccountModel::setDefault() {
|
||||||
|
|
||||||
void AccountModel::removeAccount() {
|
void AccountModel::removeAccount() {
|
||||||
auto core = CoreModel::getInstance()->getCore();
|
auto core = CoreModel::getInstance()->getCore();
|
||||||
auto authInfo = mMonitor->findAuthInfo();
|
qDebug() << log()
|
||||||
if (authInfo) {
|
.arg("Removing account [%1]")
|
||||||
core->removeAuthInfo(authInfo);
|
.arg(mMonitor ? Utils::coreStringToAppString(mMonitor->getContactAddress()->asString()) : "Null");
|
||||||
}
|
|
||||||
core->removeAccount(mMonitor);
|
core->removeAccount(mMonitor);
|
||||||
removeUserData(mMonitor);
|
|
||||||
emit removed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<linphone::Account> AccountModel::getAccount() const {
|
std::shared_ptr<linphone::Account> AccountModel::getAccount() const {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue