From 7f091a666d7db4982c91168cf5e43d7edf60a321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sat, 30 May 2015 20:32:22 +0200 Subject: [PATCH] fixed threads leak when a comic is loaded: YACReader(render) and YACReaderLibrary(comiccontroller) --- YACReader/render.cpp | 3 +++ YACReaderLibrary/server/controllers/comiccontroller.cpp | 3 +++ common/comic.cpp | 3 --- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/YACReader/render.cpp b/YACReader/render.cpp index 26549d34..cc53b8c5 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -814,6 +814,9 @@ void Render::startLoad() comic->moveToThread(thread); + connect(comic, SIGNAL(errorOpening()), thread, SLOT(quit())); + connect(comic, SIGNAL(errorOpening(QString)), thread, SLOT(quit())); + connect(comic, SIGNAL(imagesLoaded()), thread, SLOT(quit())); connect(thread, SIGNAL(started()), comic, SLOT(process())); connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); diff --git a/YACReaderLibrary/server/controllers/comiccontroller.cpp b/YACReaderLibrary/server/controllers/comiccontroller.cpp index 7f6468f1..52ae4e00 100644 --- a/YACReaderLibrary/server/controllers/comiccontroller.cpp +++ b/YACReaderLibrary/server/controllers/comiccontroller.cpp @@ -56,6 +56,9 @@ void ComicController::service(HttpRequest& request, HttpResponse& response) comicFile->moveToThread(thread); + connect(comicFile, SIGNAL(errorOpening()), thread, SLOT(quit())); + connect(comicFile, SIGNAL(errorOpening(QString)), thread, SLOT(quit())); + connect(comicFile, SIGNAL(imagesLoaded()), thread, SLOT(quit())); connect(thread, SIGNAL(started()), comicFile, SLOT(process())); connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); diff --git a/common/comic.cpp b/common/comic.cpp index f34d26b6..77c3f4eb 100644 --- a/common/comic.cpp +++ b/common/comic.cpp @@ -533,7 +533,6 @@ void FileComic::process() }*/ emit imagesLoaded(); - //moveToThread(QApplication::instance()->thread()); } @@ -622,7 +621,6 @@ void FolderComic::process() } } emit imagesLoaded(); - moveToThread(QApplication::instance()->thread()); } //////////////////////////////////////////////////////////////////////////////// @@ -746,7 +744,6 @@ void PDFComic::process() delete pdfComic; emit imagesLoaded(); - moveToThread(QApplication::instance()->thread()); } void PDFComic::renderPage(int page)