-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix manage tiles screen crash if there are tiles, updating tiles #2568
Conversation
hmm I still see the same "Reading a state" error here |
That's unexpected, is it still crashing when trying to update |
Yup looks to be tile label
|
The tile label is now set on line 91 instead of 81, are you sure that the app has been updated? |
ah firebase app got the best of me, usualy the releases are listed in numerical version code order but these last 3 are not. 🤦 indeed the fix works, sorry about that |
Summary
#2540 introduced two potential crashes when opening the 'Manage Tiles' screen if there are any tiles stored in the database and a bug for updating existing tiles. I guess everyone tested a fresh install and didn't press back?
1: A crash because we're trying to update state used by Compose while it is a snapshot on the IO thread. Fixed by switching to the main thread when updating these variables.
java.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
2: A crash because we launch multiple suspending functions in the
init
block, which can cause a race condition for alateinit
variable. Fixed by checking if it is initialized before using it.kotlin.UninitializedPropertyAccessException: lateinit property iconPack has not been initialized
3: When the
id
of a tile is set to 0, Room will autogenerate a new ID and the existing data in the database is never updated. Fixed by correctly reading and re-using the ID of the database entry like before. (id
!=tileId
, I'm not entirely sure why we have two IDs and that's likely why this mistake was made)Screenshots
n/a
Link to pull request in Documentation repository
n/a
Any other notes
cc @NotWoods