Fixed crash in update comic controller, it looks like something has changed in how qt manages sql queries when the go out of scope, a call to clear releases everything and the crash doesn't happen anymore. I have to see if it is a good idea to call clear always....

This commit is contained in:
Luis Ángel San Martín 2017-09-27 19:29:16 +02:00
parent 2b70a5907f
commit 79beadb952

View File

@ -243,6 +243,9 @@ void DBHelper::update(qulonglong libraryId, ComicInfo & comicInfo)
void DBHelper::update(ComicInfo * comicInfo, QSqlDatabase & db)
{
if(comicInfo == nullptr)
return;
QSqlQuery updateComicInfo(db);
updateComicInfo.prepare("UPDATE comic_info SET "
"title = :title,"
@ -385,7 +388,7 @@ void DBHelper::updateProgress(qulonglong libraryId, const ComicInfo &comicInfo)
comic.info.currentPage = comicInfo.currentPage;
comic.info.hasBeenOpened = true;
DBHelper::update(&comic.info,db);
DBHelper::updateReadingRemoteProgress(comic.info,db);
db.close();
QSqlDatabase::removeDatabase(libraryPath);
@ -407,6 +410,8 @@ void DBHelper::updateReadingRemoteProgress(const ComicInfo &comicInfo, QSqlDatab
updateComicInfo.bindValue(":id", comicInfo.id);
updateComicInfo.bindValue(":rating", comicInfo.rating);
updateComicInfo.exec();
updateComicInfo.clear();
}