Fix crash caused by accessing the UI thread from a background thread.

ComicVineDialog was calling close from background, plus accepted is emmited from a background thread, so it needs a QueuedConnection.
This commit is contained in:
Luis Ángel San Martín 2018-05-31 18:09:41 +02:00
parent 26c2226032
commit 229afbc9a9
2 changed files with 4 additions and 6 deletions

View File

@ -111,6 +111,8 @@ void ComicVineDialog::doConnections()
connect(selectVolumeWidget,SIGNAL(loadPage(QString,int)),this,SLOT(searchVolume(QString,int)));
connect(selectComicWidget,SIGNAL(loadPage(QString,int)),this,SLOT(getVolumeComicsInfo(QString,int)));
connect(sortVolumeComicsWidget,SIGNAL(loadPage(QString,int)),this,SLOT(getVolumeComicsInfo(QString,int)));
connect(this, SIGNAL(accepted()), this, SLOT(close()), Qt::QueuedConnection);
}
void ComicVineDialog::goNext()
@ -456,7 +458,6 @@ void ComicVineDialog::getComicsInfo(QList<QPair<ComicDB, QString> > & matchingIn
db.close();
QSqlDatabase::removeDatabase(db.connectionName());
close();
emit accepted();
}
@ -472,8 +473,7 @@ void ComicVineDialog::getComicInfo(const QString &comicId, int count, const QStr
//TODO
if(mode == SingleComic || currentIndex == (comics.count()-1))
{
close();
emit accepted();
emit accepted();
} else
{
goToNextComic();
@ -496,7 +496,6 @@ void ComicVineDialog::getComicInfo(const QString &comicId, int count, const QStr
if(mode == SingleComic || currentIndex == (comics.count()-1))
{
close();
emit accepted();
} else
{
@ -645,7 +644,6 @@ void ComicVineDialog::goToNextComic()
{
if(mode == SingleComic || currentIndex == (comics.count()-1))
{
close();
emit accepted();
return;
}

View File

@ -1054,7 +1054,7 @@ void LibraryWindow::createConnections()
connect(propertiesDialog,SIGNAL(accepted()),navigationController,SLOT(reselectCurrentSource()));
//comic vine
connect(comicVineDialog,SIGNAL(accepted()),navigationController,SLOT(reselectCurrentSource()));
connect(comicVineDialog,SIGNAL(accepted()),navigationController,SLOT(reselectCurrentSource()), Qt::QueuedConnection);
connect(updateLibraryAction,SIGNAL(triggered()),this,SLOT(updateLibrary()));
connect(renameLibraryAction,SIGNAL(triggered()),this,SLOT(renameLibrary()));