mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Fixed thread leak when a comic has to be destroyed while it is being processed.
This commit is contained in:
parent
618214f667
commit
2b70a5907f
@ -761,6 +761,8 @@ void Render::createComic(const QString & path)
|
|||||||
if(comic!=0)
|
if(comic!=0)
|
||||||
{
|
{
|
||||||
//comic->moveToThread(QApplication::instance()->thread());
|
//comic->moveToThread(QApplication::instance()->thread());
|
||||||
|
comic->invalidate();
|
||||||
|
|
||||||
comic->disconnect();
|
comic->disconnect();
|
||||||
comic->deleteLater();
|
comic->deleteLater();
|
||||||
}
|
}
|
||||||
@ -817,6 +819,7 @@ void Render::startLoad()
|
|||||||
connect(comic, SIGNAL(errorOpening(QString)), thread, SLOT(quit()), Qt::QueuedConnection);
|
connect(comic, SIGNAL(errorOpening(QString)), thread, SLOT(quit()), Qt::QueuedConnection);
|
||||||
connect(comic, SIGNAL(imagesLoaded()), 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(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(started()), comic, SLOT(process()));
|
||||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||||
|
|
||||||
|
@ -199,7 +199,12 @@ void Comic::updateBookmarkImage(int index)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Comic::setPageLoaded(int page)
|
void Comic::setPageLoaded(int page)
|
||||||
{
|
{
|
||||||
_loadedPages[page] = true;
|
_loadedPages[page] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Comic::invalidate()
|
||||||
|
{
|
||||||
|
emit invalidated();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
QByteArray Comic::getRawPage(int page)
|
QByteArray Comic::getRawPage(int page)
|
||||||
|
@ -86,8 +86,10 @@ class Comic : public QObject
|
|||||||
void checkIsBookmark(int index);
|
void checkIsBookmark(int index);
|
||||||
void updateBookmarkImage(int);
|
void updateBookmarkImage(int);
|
||||||
void setPageLoaded(int page);
|
void setPageLoaded(int page);
|
||||||
|
void invalidate();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void invalidated();
|
||||||
void destroyed();
|
void destroyed();
|
||||||
void imagesLoaded();
|
void imagesLoaded();
|
||||||
void imageLoaded(int index);
|
void imageLoaded(int index);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user