diff --git a/src/chat/chat-message/chat-message.cpp b/src/chat/chat-message/chat-message.cpp index 7b7cbb054..a966e98bf 100644 --- a/src/chat/chat-message/chat-message.cpp +++ b/src/chat/chat-message/chat-message.cpp @@ -450,7 +450,7 @@ void ChatMessagePrivate::notifyReceiving () { LinphoneChatRoom *chatRoom = L_GET_C_BACK_PTR(q->getChatRoom()); if ((getContentType() != ContentType::Imdn) && (getContentType() != ContentType::ImIsComposing)) { linphone_chat_room_notify_chat_message_should_be_stored(chatRoom, L_GET_C_BACK_PTR(q->getSharedFromThis())); - + if (toBeStored) storeInDb(); } @@ -784,6 +784,9 @@ void ChatMessagePrivate::updateInDb () { unique_ptr &mainDb = q->getChatRoom()->getCore()->getPrivate()->mainDb; shared_ptr eventLog = mainDb->getEventFromKey(dbKey); + + // Avoid transaction in transaction if contents are not loaded. + loadContentsFromDatabase(); mainDb->updateEvent(eventLog); if (direction == ChatMessage::Direction::Incoming) { diff --git a/src/db/main-db.cpp b/src/db/main-db.cpp index 0502ab1be..584186215 100644 --- a/src/db/main-db.cpp +++ b/src/db/main-db.cpp @@ -1410,11 +1410,6 @@ void MainDb::init () { return sanitized; }; - // Disable locking. (Issue on Android on crash.) - // See: https://stackoverflow.com/questions/17348480/how-do-i-prevent-sqlite-database-locks - if (backend == Sqlite3) - *session << "PRAGMA read_uncommitted = ON"; - // TODO: Migrate all statements in statements.cpp. *session << "CREATE TABLE IF NOT EXISTS sip_address ("