mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
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:
parent
2b70a5907f
commit
79beadb952
@ -243,6 +243,9 @@ void DBHelper::update(qulonglong libraryId, ComicInfo & comicInfo)
|
|||||||
|
|
||||||
void DBHelper::update(ComicInfo * comicInfo, QSqlDatabase & db)
|
void DBHelper::update(ComicInfo * comicInfo, QSqlDatabase & db)
|
||||||
{
|
{
|
||||||
|
if(comicInfo == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
QSqlQuery updateComicInfo(db);
|
QSqlQuery updateComicInfo(db);
|
||||||
updateComicInfo.prepare("UPDATE comic_info SET "
|
updateComicInfo.prepare("UPDATE comic_info SET "
|
||||||
"title = :title,"
|
"title = :title,"
|
||||||
@ -385,7 +388,7 @@ void DBHelper::updateProgress(qulonglong libraryId, const ComicInfo &comicInfo)
|
|||||||
comic.info.currentPage = comicInfo.currentPage;
|
comic.info.currentPage = comicInfo.currentPage;
|
||||||
comic.info.hasBeenOpened = true;
|
comic.info.hasBeenOpened = true;
|
||||||
|
|
||||||
DBHelper::update(&comic.info,db);
|
DBHelper::updateReadingRemoteProgress(comic.info,db);
|
||||||
|
|
||||||
db.close();
|
db.close();
|
||||||
QSqlDatabase::removeDatabase(libraryPath);
|
QSqlDatabase::removeDatabase(libraryPath);
|
||||||
@ -407,6 +410,8 @@ void DBHelper::updateReadingRemoteProgress(const ComicInfo &comicInfo, QSqlDatab
|
|||||||
updateComicInfo.bindValue(":id", comicInfo.id);
|
updateComicInfo.bindValue(":id", comicInfo.id);
|
||||||
updateComicInfo.bindValue(":rating", comicInfo.rating);
|
updateComicInfo.bindValue(":rating", comicInfo.rating);
|
||||||
updateComicInfo.exec();
|
updateComicInfo.exec();
|
||||||
|
|
||||||
|
updateComicInfo.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user