Fixed leak of AccountSettingsViewModel causing linphone_core_find_auth_info(): returning auth info log increase after each register
This commit is contained in:
parent
dbea44d199
commit
d0c20db2c6
1 changed files with 4 additions and 2 deletions
|
@ -50,7 +50,8 @@ class SideMenuViewModel : ViewModel() {
|
||||||
state: RegistrationState,
|
state: RegistrationState,
|
||||||
message: String
|
message: String
|
||||||
) {
|
) {
|
||||||
if (coreContext.core.accountList.size != accounts.value?.size) {
|
// +1 is for the default account, otherwise this will trigger every time
|
||||||
|
if (coreContext.core.accountList.size != accounts.value.orEmpty().size + 1) {
|
||||||
// Only refresh the list if an account has been added or removed
|
// Only refresh the list if an account has been added or removed
|
||||||
updateAccountsList()
|
updateAccountsList()
|
||||||
}
|
}
|
||||||
|
@ -73,8 +74,9 @@ class SideMenuViewModel : ViewModel() {
|
||||||
|
|
||||||
fun updateAccountsList() {
|
fun updateAccountsList() {
|
||||||
defaultAccountFound.value = false // Do not assume a default account will still be found
|
defaultAccountFound.value = false // Do not assume a default account will still be found
|
||||||
|
defaultAccountViewModel.value?.destroy()
|
||||||
accounts.value.orEmpty().forEach(AccountSettingsViewModel::destroy)
|
accounts.value.orEmpty().forEach(AccountSettingsViewModel::destroy)
|
||||||
|
|
||||||
val list = arrayListOf<AccountSettingsViewModel>()
|
val list = arrayListOf<AccountSettingsViewModel>()
|
||||||
if (coreContext.core.accountList.isNotEmpty()) {
|
if (coreContext.core.accountList.isNotEmpty()) {
|
||||||
val defaultAccount = coreContext.core.defaultAccount
|
val defaultAccount = coreContext.core.defaultAccount
|
||||||
|
|
Loading…
Reference in a new issue