From 856b0d8139b77a4cdf5aebbbd3de40995d30f3c7 Mon Sep 17 00:00:00 2001 From: Alex Jbanca Date: Tue, 5 Sep 2023 13:16:41 +0300 Subject: [PATCH] fix: Crash when 1-1 chats order is changing in the UI (cherry picked from commit ba00228d0ff0b62e82f39d6a6841789f113bbc7f) --- src/app/modules/main/chat_section/model.nim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/modules/main/chat_section/model.nim b/src/app/modules/main/chat_section/model.nim index 5c14a044b2..24794efe8e 100644 --- a/src/app/modules/main/chat_section/model.nim +++ b/src/app/modules/main/chat_section/model.nim @@ -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*(