diff --git a/changelog.d/3538.bugfix b/changelog.d/3538.bugfix new file mode 100644 index 0000000000..bad8f045ba --- /dev/null +++ b/changelog.d/3538.bugfix @@ -0,0 +1 @@ +Fix crash on signout: release session at the end of clean up. \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cleanup/CleanupSession.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cleanup/CleanupSession.kt index b5c1e6a282..8870d92a35 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cleanup/CleanupSession.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cleanup/CleanupSession.kt @@ -51,15 +51,12 @@ internal class CleanupSession @Inject constructor( @UserMd5 private val userMd5: String ) { suspend fun handle() { - Timber.d("Cleanup: release session...") - sessionManager.releaseSession(sessionId) + Timber.d("Cleanup: delete session params...") + sessionParamsStore.delete(sessionId) Timber.d("Cleanup: cancel pending works...") workManagerProvider.cancelAllWorks() - Timber.d("Cleanup: delete session params...") - sessionParamsStore.delete(sessionId) - Timber.d("Cleanup: clear session data...") clearSessionDataTask.execute(Unit) @@ -74,6 +71,9 @@ internal class CleanupSession @Inject constructor( realmKeysUtils.clear(SessionModule.getKeyAlias(userMd5)) realmKeysUtils.clear(CryptoModule.getKeyAlias(userMd5)) + Timber.d("Cleanup: release session...") + sessionManager.releaseSession(sessionId) + // Sanity check if (BuildConfig.DEBUG) { Realm.getGlobalInstanceCount(realmSessionConfiguration)