fixed some memory leaks, close #744
This commit is contained in:
parent
952dddba03
commit
ab96713b8e
|
@ -611,7 +611,6 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
|||
context: Context,
|
||||
val firsSyncLoad: Boolean
|
||||
) : FixedAsyncTaskLoader<AccountsInfo>(context) {
|
||||
private val am = AccountManager.get(context)
|
||||
|
||||
private var contentObserver: ContentObserver? = null
|
||||
set(value) {
|
||||
|
@ -624,6 +623,7 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
|||
}
|
||||
private var accountListener: OnAccountsUpdateListener? = null
|
||||
set(value) {
|
||||
val am = AccountManager.get(context)
|
||||
field?.let {
|
||||
am.removeOnAccountsUpdatedListenerSafe(it)
|
||||
}
|
||||
|
|
|
@ -18,10 +18,9 @@ class AccountDetailsLoader(
|
|||
val filter: (AccountDetails.() -> Boolean)? = null
|
||||
) : FixedAsyncTaskLoader<List<AccountDetails>>(context) {
|
||||
|
||||
private val am: AccountManager = AccountManager.get(context)
|
||||
|
||||
private var accountUpdateListener: OnAccountsUpdateListener? = null
|
||||
set(value) {
|
||||
val am: AccountManager = AccountManager.get(context)
|
||||
field?.let {
|
||||
am.removeOnAccountsUpdatedListenerSafe(it)
|
||||
}
|
||||
|
@ -31,6 +30,7 @@ class AccountDetailsLoader(
|
|||
}
|
||||
|
||||
override fun loadInBackground(): List<AccountDetails> {
|
||||
val am: AccountManager = AccountManager.get(context)
|
||||
return AccountUtils.getAllAccountDetails(am, true).filter {
|
||||
filter?.invoke(it) ?: true
|
||||
}.sortedBy(AccountDetails::position)
|
||||
|
|
Loading…
Reference in New Issue