Commit ac482f58 authored by Ronan's avatar Ronan

fix(MainDb): fix sql lock

parent e0b2b412
......@@ -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> &mainDb = q->getChatRoom()->getCore()->getPrivate()->mainDb;
shared_ptr<EventLog> eventLog = mainDb->getEventFromKey(dbKey);
// Avoid transaction in transaction if contents are not loaded.
loadContentsFromDatabase();
mainDb->updateEvent(eventLog);
if (direction == ChatMessage::Direction::Incoming) {
......
......@@ -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 ("
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment