Commit 1a563a3
fix(deck-picker) freeze after theme changes
Fixes deadlocking in DeckPicker when changing themes by adding buffers to MutableSharedFlow instances.
The issue occurred because:
1. DeckPicker uses launchCollectionInLifecycleScope which only collects flows when activity is RESUMED
2. During theme changes, the activity is recreated and temporarily not in RESUMED state
3. emit() calls on MutableSharedFlow without buffers would suspend indefinitely when no collectors were active
4. This caused the app to freeze/hang after theme changes
Solution:
- Added extraBufferCapacity = 1 to all MutableSharedFlow instances in DeckPickerViewModel
- This allows emit() calls to succeed even when no collectors are active
- The buffered events will be processed when collectors resume
Fixes 19512
Co-authored-by: raiyyan <[email protected]>1 parent 46cc209 commit 1a563a3
File tree
1 file changed
+9
-9
lines changed- AnkiDroid/src/main/java/com/ichi2/anki/deckpicker
1 file changed
+9
-9
lines changedLines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
0 commit comments