Save cached data before feed update too.

This commit is contained in:
martinrotter 2017-04-24 06:38:14 +02:00
parent a2e1043d85
commit 49f76775f4
2 changed files with 6 additions and 2 deletions

View File

@ -160,6 +160,9 @@ void Feed::run() {
<< customId() << " in thread: \'"
<< QThread::currentThreadId() << "\'.";
// Save all cached data first.
getParentServiceRoot()->saveAllCachedData();
bool error_during_obtaining;
QList<Message> msgs = obtainNewMessages(&error_during_obtaining);

View File

@ -135,13 +135,14 @@ void OwnCloudServiceRoot::addMessageStatesToCache(const QStringList &ids_of_mess
}
void OwnCloudServiceRoot::saveAllCachedData() {
m_cacheSaveMutex->lock();
if (m_cachedStatesRead.isEmpty() && m_cachedStatesImportant.isEmpty()) {
// No cached changes.
m_cacheSaveMutex->unlock();
return;
}
m_cacheSaveMutex->lock();
// Make copy of changes.
QMap<RootItem::ReadStatus, QStringList> cached_data_read = m_cachedStatesRead;
cached_data_read.detach();