From 91352ffccd1edba32f56794194b0cc2695acd387 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Wed, 18 Nov 2015 13:27:35 +0100 Subject: [PATCH] message_storage.c: remove invalid assert in linphone_chat_room_delete_message and force recomputation of unread messages count after removal, since database is not synced anymore with chat messages in memory --- coreapi/message_storage.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/coreapi/message_storage.c b/coreapi/message_storage.c index f12b63ec6..7b60a8e4a 100644 --- a/coreapi/message_storage.c +++ b/coreapi/message_storage.c @@ -417,10 +417,9 @@ void linphone_chat_room_delete_message(LinphoneChatRoom *cr, LinphoneChatMessage linphone_sql_request(lc->db,buf); sqlite3_free(buf); - if(cr->unread_count >= 0 && !msg->is_read) { - assert(cr->unread_count > 0); - cr->unread_count--; - } + /* Invalidate unread_count when we modify the database, so that next + time we need it it will be recomputed from latest database state */ + cr->unread_count = -1; } void linphone_chat_room_delete_history(LinphoneChatRoom *cr){