-
Notifications
You must be signed in to change notification settings - Fork 359
Fix crash when calling Room.predecessorRoom when the room is destroyed
#5894
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
base: develop
Are you sure you want to change the base?
Fix crash when calling Room.predecessorRoom when the room is destroyed
#5894
Conversation
|
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5894 +/- ##
===========================================
- Coverage 81.38% 81.38% -0.01%
===========================================
Files 2479 2479
Lines 66200 66202 +2
Branches 8431 8433 +2
===========================================
+ Hits 53876 53877 +1
- Misses 9221 9223 +2
+ Partials 3103 3102 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Actually, the root cause of this issue seems to be activity recreation causing the |
bmarty
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! 2 non-blocking questions
| override val graph = roomGraphFactory.create(inputs.room) | ||
|
|
||
| // This is an ugly hack to check activity recreation | ||
| private val currentActivity = mutableStateOf<Activity?>(null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to be a MutableState? Can't it just be of type Activity?? (like in LoginFlowNode for instance)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd need to double check if this could affect the stability of the composable. Since we're only assigning the value, maybe it won't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be fine:
restartable skippable open scheme("[androidx.compose.ui.UiComposable]") fun io.element.android.appnav.room.joined.JoinedRoomLoadedFlowNode.View(
unused stable modifier: Modifier
stable <this>: JoinedRoomLoadedFlowNode
)
| if (currentActivity.value?.isChangingConfigurations != true) { | ||
| activeRoomsHolder.removeRoom(inputs.room.sessionId, inputs.room.roomId) | ||
| inputs.room.destroy() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also reset the value of currentActivity?
746f49a to
9012160
Compare
9012160 to
4ac2322
Compare
|



Content
What the title says.
Motivation and context
Fix a crash observed in the wild, when there is an activity recreation with a room opened:
Tests
With a room open, cause an activity recreation. This can be quickly done with a foldable emulator or device by folding/unfolding the device.
Tested devices
Checklist