mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Fix memory leak, comics need to be in the right thread before deleting them.
This commit is contained in:
commit
932910d0a9
@ -417,7 +417,7 @@ Render::~Render()
|
||||
{
|
||||
if(comic!=0)
|
||||
{
|
||||
//comic->moveToThread(QApplication::instance()->thread());
|
||||
comic->moveToThread(QApplication::instance()->thread());
|
||||
comic->deleteLater();
|
||||
}
|
||||
|
||||
@ -679,7 +679,7 @@ void Render::setComic(Comic * c)
|
||||
{
|
||||
if(comic !=0)
|
||||
{
|
||||
//comic->moveToThread(QApplication::instance()->thread());
|
||||
comic->moveToThread(QApplication::instance()->thread());
|
||||
comic->disconnect();
|
||||
comic->deleteLater();
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ bool FileComic::load(const QString & path, const ComicDB & comic)
|
||||
else
|
||||
{
|
||||
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit errorOpening();
|
||||
return false;
|
||||
}
|
||||
@ -540,14 +540,14 @@ void FileComic::process()
|
||||
CompressedArchive archive(_path);
|
||||
if(!archive.toolsLoaded())
|
||||
{
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit errorOpening(tr("7z not found"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!archive.isValid())
|
||||
{
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit errorOpening(tr("Format not supported"));
|
||||
return;
|
||||
}
|
||||
@ -559,7 +559,7 @@ void FileComic::process()
|
||||
if(_fileNames.size()==0)
|
||||
{
|
||||
//QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file"));
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit errorOpening();
|
||||
return;
|
||||
}
|
||||
@ -599,7 +599,7 @@ void FileComic::process()
|
||||
{
|
||||
if(_invalidated)
|
||||
{
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
return;
|
||||
}
|
||||
archive.getAllData(sections.at(i),this);
|
||||
@ -608,7 +608,7 @@ void FileComic::process()
|
||||
{
|
||||
if(_invalidated)
|
||||
{
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
return;
|
||||
}
|
||||
archive.getAllData(sections.at(i),this);
|
||||
@ -623,7 +623,7 @@ void FileComic::process()
|
||||
emit imageLoaded(sortedIndex);
|
||||
emit imageLoaded(sortedIndex,_pages[sortedIndex]);
|
||||
}*/
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit imagesLoaded();
|
||||
}
|
||||
|
||||
@ -683,7 +683,7 @@ void FolderComic::process()
|
||||
{
|
||||
//TODO emitir este mensaje en otro sitio
|
||||
//QMessageBox::critical(NULL,QObject::tr("No images found"),QObject::tr("There are not images on the selected folder"));
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit errorOpening();
|
||||
}
|
||||
else
|
||||
@ -712,7 +712,7 @@ void FolderComic::process()
|
||||
{
|
||||
if(_invalidated)
|
||||
{
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -729,7 +729,7 @@ void FolderComic::process()
|
||||
count++;
|
||||
}
|
||||
}
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit imagesLoaded();
|
||||
}
|
||||
|
||||
@ -774,7 +774,7 @@ bool PDFComic::load(const QString & path, int atPage)
|
||||
}
|
||||
else
|
||||
{
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit errorOpening();
|
||||
return false;
|
||||
}
|
||||
@ -799,7 +799,7 @@ bool PDFComic::load(const QString & path, const ComicDB & comic)
|
||||
else
|
||||
{
|
||||
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit errorOpening();
|
||||
return false;
|
||||
}
|
||||
@ -829,13 +829,13 @@ void PDFComic::process()
|
||||
{
|
||||
//delete pdfComic;
|
||||
//pdfComic = 0;
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit errorOpening();
|
||||
return;
|
||||
}
|
||||
if (pdfComic->isLocked())
|
||||
{
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit errorOpening();
|
||||
return;
|
||||
}
|
||||
@ -874,7 +874,7 @@ void PDFComic::process()
|
||||
if(_invalidated)
|
||||
{
|
||||
delete pdfComic;
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -885,14 +885,14 @@ void PDFComic::process()
|
||||
if(_invalidated)
|
||||
{
|
||||
delete pdfComic;
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
return;
|
||||
}
|
||||
renderPage(i);
|
||||
}
|
||||
|
||||
delete pdfComic;
|
||||
//moveToThread(QCoreApplication::instance()->thread());
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
emit imagesLoaded();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user