Commit ac482f58 authored by Ronan's avatar Ronan

fix(MainDb): fix sql lock

parent e0b2b412
...@@ -784,6 +784,9 @@ void ChatMessagePrivate::updateInDb () { ...@@ -784,6 +784,9 @@ void ChatMessagePrivate::updateInDb () {
unique_ptr<MainDb> &mainDb = q->getChatRoom()->getCore()->getPrivate()->mainDb; unique_ptr<MainDb> &mainDb = q->getChatRoom()->getCore()->getPrivate()->mainDb;
shared_ptr<EventLog> eventLog = mainDb->getEventFromKey(dbKey); shared_ptr<EventLog> eventLog = mainDb->getEventFromKey(dbKey);
// Avoid transaction in transaction if contents are not loaded.
loadContentsFromDatabase();
mainDb->updateEvent(eventLog); mainDb->updateEvent(eventLog);
if (direction == ChatMessage::Direction::Incoming) { if (direction == ChatMessage::Direction::Incoming) {
......
...@@ -1410,11 +1410,6 @@ void MainDb::init () { ...@@ -1410,11 +1410,6 @@ void MainDb::init () {
return sanitized; 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. // TODO: Migrate all statements in statements.cpp.
*session << *session <<
"CREATE TABLE IF NOT EXISTS sip_address (" "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