Fixed thread leak when a comic has to be destroyed while it is being processed.

This commit is contained in:
Luis Ángel San Martín
2017-09-27 09:38:50 +02:00
parent 618214f667
commit 2b70a5907f
3 changed files with 11 additions and 1 deletions

View File

@ -761,6 +761,8 @@ void Render::createComic(const QString & path)
if(comic!=0)
{
//comic->moveToThread(QApplication::instance()->thread());
comic->invalidate();
comic->disconnect();
comic->deleteLater();
}
@ -817,6 +819,7 @@ void Render::startLoad()
connect(comic, SIGNAL(errorOpening(QString)), thread, SLOT(quit()), Qt::QueuedConnection);
connect(comic, SIGNAL(imagesLoaded()), thread, SLOT(quit()), Qt::QueuedConnection);
connect(comic, SIGNAL(destroyed()), thread, SLOT(quit()), Qt::QueuedConnection);
connect(comic, SIGNAL(invalidated()), thread, SLOT(quit()), Qt::QueuedConnection);
connect(thread, SIGNAL(started()), comic, SLOT(process()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));