Skip to content

fix: Don't crash when prompting for notification provider#1987

Merged
nikclayton merged 1 commit intopachli:mainfrom
nikclayton:dialog-main
Dec 1, 2025
Merged

fix: Don't crash when prompting for notification provider#1987
nikclayton merged 1 commit intopachli:mainfrom
nikclayton:dialog-main

Conversation

@nikclayton
Copy link
Copy Markdown
Contributor

@nikclayton nikclayton commented Dec 1, 2025

Dialogs must be shown on the main (UI) thread. Enforce this in the suspend dialog extensions by explicitly switching to Dispatchers.Main.

Fixes a crash; EnableAllNotificationsUseCase runs on Dispatchers.IO (because it interacts with SharedPreferences which can perform IO) and can show a dialog. The dialog was being displayed on an IO thread and crashed with:

Can't create handler inside thread Thread[DefaultDispatcher-worker-9,5,main] that has not called Looper.prepare()

Fixes #1986

Dialogs must be shown on the main (UI) thread. Enforce this in the
suspend dialog extensions by explicitly switching to `Dispatchers.Main`.

Fixes a crash; EnableAllNotificationsUseCase runs on `Dispatchers.IO`
(because it interacts with `SharedPreferences` which can perform IO)
and can show a dialog. The dialog was being displayed on an IO thread
and crashed with:

Can't create handler inside thread Thread[DefaultDispatcher-worker-9,5,main] that has not called Looper.prepare()

Fixes pachli#1986
@nikclayton nikclayton merged commit 43d6b96 into pachli:main Dec 1, 2025
28 checks passed
@nikclayton nikclayton deleted the dialog-main branch December 1, 2025 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgraded to 3.2.0, after trying to load the Home tab, the app crashes and quits

1 participant