fix(MainDb): fix sql lock

This commit is contained in:
Ronan Abhamon 2018-02-23 17:22:05 +01:00
parent e0b2b41290
commit ac482f58b7
2 changed files with 4 additions and 6 deletions

View file

@ -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) {

View file

@ -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 ("