fixed memory leak caused by Comic not being freed properly

This commit is contained in:
Luis Ángel San Martín 2015-05-31 19:25:04 +02:00
parent 7f091a666d
commit 7a0bd8dc68

View File

@ -309,6 +309,7 @@ bool FileComic::load(const QString & path, const ComicDB & comic)
else else
{ {
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path); //QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
moveToThread(QApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return false; return false;
} }
@ -475,12 +476,14 @@ void FileComic::process()
CompressedArchive archive(_path); CompressedArchive archive(_path);
if(!archive.toolsLoaded()) if(!archive.toolsLoaded())
{ {
moveToThread(QApplication::instance()->thread());
emit errorOpening(tr("7z not found")); emit errorOpening(tr("7z not found"));
return; return;
} }
if(!archive.isValid()) if(!archive.isValid())
{ {
moveToThread(QApplication::instance()->thread());
emit errorOpening(tr("Format not supported")); emit errorOpening(tr("Format not supported"));
return; return;
} }
@ -492,6 +495,7 @@ void FileComic::process()
if(_fileNames.size()==0) if(_fileNames.size()==0)
{ {
//QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file")); //QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file"));
moveToThread(QApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return; return;
} }
@ -531,7 +535,7 @@ void FileComic::process()
emit imageLoaded(sortedIndex); emit imageLoaded(sortedIndex);
emit imageLoaded(sortedIndex,_pages[sortedIndex]); emit imageLoaded(sortedIndex,_pages[sortedIndex]);
}*/ }*/
moveToThread(QApplication::instance()->thread());
emit imagesLoaded(); emit imagesLoaded();
} }
@ -590,6 +594,7 @@ void FolderComic::process()
{ {
//TODO emitir este mensaje en otro sitio //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")); //QMessageBox::critical(NULL,QObject::tr("No images found"),QObject::tr("There are not images on the selected folder"));
moveToThread(QApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
} }
else else
@ -620,6 +625,7 @@ void FolderComic::process()
count++; count++;
} }
} }
moveToThread(QApplication::instance()->thread());
emit imagesLoaded(); emit imagesLoaded();
} }
@ -662,6 +668,7 @@ bool PDFComic::load(const QString & path, int atPage)
} }
else else
{ {
moveToThread(QApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return false; return false;
} }
@ -684,6 +691,7 @@ bool PDFComic::load(const QString & path, const ComicDB & comic)
else else
{ {
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path); //QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
moveToThread(QApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return false; return false;
} }
@ -707,11 +715,13 @@ void PDFComic::process()
{ {
//delete pdfComic; //delete pdfComic;
//pdfComic = 0; //pdfComic = 0;
moveToThread(QApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return; return;
} }
if (pdfComic->isLocked()) if (pdfComic->isLocked())
{ {
moveToThread(QApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return; return;
} }
@ -743,6 +753,7 @@ void PDFComic::process()
renderPage(i); renderPage(i);
delete pdfComic; delete pdfComic;
moveToThread(QApplication::instance()->thread());
emit imagesLoaded(); emit imagesLoaded();
} }