commit 355c8e942a341f4acc433020eca237e4561cb865
parent f1f12824347f9714238f973e009945e1b0628b42
Author: pollymce <pmceldowney@mozilla.com>
Date: Thu, 20 Nov 2025 16:31:45 +0000
Bug 1999784 - fix crash on add password. r=android-reviewers,mcarare
This is very similar to the previously fixed scenario on edit password - a store action was being dispatched using io scope, then it does some ui stuff that requires the main thread. Thread management is no longer handled as a side effect of the Store type you choose, so we need to be explicit here and launch the ui code on main.
Differential Revision: https://phabricator.services.mozilla.com/D273418
Diffstat:
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/logins/ui/LoginsMiddleware.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/logins/ui/LoginsMiddleware.kt
@@ -187,16 +187,18 @@ internal class LoginsMiddleware(
try {
val loginAdded = loginsStorage.add(newLoginToAdd)
- dispatch(
- LoginClicked(
- LoginItem(
- guid = loginAdded.guid,
- url = loginAdded.origin,
- username = loginAdded.username,
- password = loginAdded.password,
+ mainScope.launch {
+ dispatch(
+ LoginClicked(
+ LoginItem(
+ guid = loginAdded.guid,
+ url = loginAdded.origin,
+ username = loginAdded.username,
+ password = loginAdded.password,
+ ),
),
- ),
- )
+ )
+ }
} catch (exception: LoginsApiException) {
exception.printStackTrace()
}