App crashes when conversation is deleted and user presses navigation buttons #1

Open
opened 2024-08-26 01:32:32 +02:00 by VityaSchel · 0 comments
VityaSchel commented 2024-08-26 01:32:32 +02:00 (Migrated from github.com)

Changing any navigation state

Thread 1: EXC_BREAKPOINT (code=1, subcode=0x2188b5e9c)

#3	0x00000001028bb478 in Conversation.recipient.getter at /var/folders/gg/nqnk92m139525f19b5l2b1qr0000gn/T/swift-generated-sources/@__swiftmacro_14Session_Native12ConversationC9recipient18_PersistedPropertyfMa_.swift:9

In ConversationPreviewItem

Avatar(avatar: conversation.recipient.avatar)

From that information, it becomes obvious that Swift tries to access data of deleted object when the component (ConversationPreviewItem view) is already long time gone.

Test cases

The following cases all end with switching screen or clicking "add conversation" button or showing/hiding search. At this point app either crashes or not.

Cases when issue occurs

a. One opened chat

  1. Go to conversations screen
  2. Create conversation
  3. Open it
  4. Delete via context menu

b. One non-opened chats

  1. Go to conversations screen
  2. Create conversation
  3. Switch to another screen, go back to reset selection of conversation
  4. Delete via context menu

c. Two chats

  1. Go to conversations screen
  2. Create two conversations
  3. Select conversation "A"
  4. Delete conversation "B"

d. Three chats, deleting last

  1. Go to conversation screen
  2. Create three conversations
  3. Delete conversation "C"

Cases when issue does not occur

a. Two chats, deleting selected

  1. Go to conversation screen
  2. Create two conversations
  3. Select conversation "A"
  4. Delete conversation "A"

b. Three chats, deleting first

  1. Go to conversation screen
  2. Create three conversations
  3. Delete conversation "A"

Conclusion

From my understanding based on tests, regardless of how many chats left in List, you mustn't delete the last one, otherwise it breaks

Possible solution: add fake last item that is not visible to anyone and continue tests.

Changing any navigation state `Thread 1: EXC_BREAKPOINT (code=1, subcode=0x2188b5e9c)` ``` #3 0x00000001028bb478 in Conversation.recipient.getter at /var/folders/gg/nqnk92m139525f19b5l2b1qr0000gn/T/swift-generated-sources/@__swiftmacro_14Session_Native12ConversationC9recipient18_PersistedPropertyfMa_.swift:9 ``` In ConversationPreviewItem ``` Avatar(avatar: conversation.recipient.avatar) ``` From that information, it becomes obvious that Swift tries to access data of deleted object when the component (ConversationPreviewItem view) is already long time gone. # Test cases The following cases all end with switching screen or clicking "add conversation" button or showing/hiding search. At this point app either crashes or not. ## Cases when issue occurs ### a. One opened chat 1. Go to conversations screen 2. Create conversation 3. Open it 4. Delete via context menu ### b. One non-opened chats 1. Go to conversations screen 2. Create conversation 3. Switch to another screen, go back to reset selection of conversation 4. Delete via context menu ### c. Two chats 1. Go to conversations screen 2. Create two conversations 3. Select conversation "A" 4. Delete conversation "B" ### d. Three chats, deleting last 1. Go to conversation screen 2. Create three conversations 3. Delete conversation "C" ## Cases when issue does not occur ### a. Two chats, deleting selected 1. Go to conversation screen 4. Create two conversations 5. Select conversation "A" 6. Delete conversation "A" ### b. Three chats, deleting first 1. Go to conversation screen 2. Create three conversations 3. Delete conversation "A" # Conclusion From my understanding based on tests, regardless of how many chats left in List, you mustn't delete the last one, otherwise it breaks Possible solution: add fake last item that is not visible to anyone and continue tests.
Commenting is not possible because the repository is archived.
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: hloth/session-native#1
No description provided.