fix: Crash when 1-1 chats order is changing in the UI

(cherry picked from commit ba00228d0f)
This commit is contained in:
Alex Jbanca 2023-09-05 13:16:41 +03:00 committed by Jonathan Rainville
parent 99b2a87fe4
commit 856b0d8139
1 changed files with 3 additions and 0 deletions

View File

@ -340,6 +340,7 @@ QtObject:
self.items[index].icon = icon
self.items[index].trustStatus = trustStatus
let modelIndex = self.createIndex(index, 0, nil)
defer: modelIndex.delete
self.dataChanged(modelIndex, modelIndex, @[
ModelRole.Name.int,
ModelRole.Icon.int,
@ -355,6 +356,7 @@ QtObject:
self.items[index].emoji = emoji
self.items[index].color = color
let modelIndex = self.createIndex(index, 0, nil)
defer: modelIndex.delete
self.dataChanged(modelIndex, modelIndex, @[
ModelRole.Name.int,
ModelRole.Description.int,
@ -509,6 +511,7 @@ QtObject:
return
self.items[index].lastMessageTimestamp = lastMessageTimestamp
let modelIndex = self.createIndex(index, 0, nil)
defer: modelIndex.delete
self.dataChanged(modelIndex, modelIndex, @[ModelRole.LastMessageTimestamp.int])
proc reorderChats*(