From 90754baa797e26d55bf392436fd21aa97a7b171e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sat, 6 Jan 2018 08:55:56 +0100 Subject: [PATCH] Clear pagesEmited in Render to avoid reusing them when a new comic has been opened. --- YACReader/render.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/YACReader/render.cpp b/YACReader/render.cpp index 6a0fcf19..e3f6cc44 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -759,6 +759,9 @@ void Render::load(const QString & path, const ComicDB & comicDB) void Render::createComic(const QString & path) { + previousIndex = currentIndex = 0; + pagesEmited.clear(); + if(comic!=0) { //comic->moveToThread(QApplication::instance()->thread()); @@ -770,7 +773,6 @@ void Render::createComic(const QString & path) //comic->moveToThread(QApplication::instance()->thread()); comic = FactoryComic::newComic(path); - if(comic == NULL)//archivo no encontrado o no vĂ¡lido { emit errorOpening(); @@ -778,14 +780,12 @@ void Render::createComic(const QString & path) return; } - previousIndex = currentIndex = 0; - connect(comic,SIGNAL(errorOpening()),this,SIGNAL(errorOpening()), Qt::QueuedConnection); connect(comic,SIGNAL(errorOpening(QString)),this,SIGNAL(errorOpening(QString)), Qt::QueuedConnection); connect(comic,SIGNAL(crcErrorFound(QString)),this,SIGNAL(crcError(QString)), Qt::QueuedConnection); connect(comic,SIGNAL(errorOpening()),this,SLOT(reset()), Qt::QueuedConnection); - connect(comic,SIGNAL(imageLoaded(int)),this,SIGNAL(imageLoaded(int)), Qt::QueuedConnection); connect(comic,SIGNAL(imageLoaded(int)),this,SLOT(pageRawDataReady(int)), Qt::QueuedConnection); + connect(comic,SIGNAL(imageLoaded(int)),this,SIGNAL(imageLoaded(int)), Qt::QueuedConnection); connect(comic,SIGNAL(openAt(int)),this,SLOT(renderAt(int)), Qt::QueuedConnection); connect(comic,SIGNAL(numPages(unsigned int)),this,SIGNAL(numPages(unsigned int)), Qt::QueuedConnection); connect(comic,SIGNAL(numPages(unsigned int)),this,SLOT(setNumPages(unsigned int)), Qt::QueuedConnection); @@ -954,7 +954,10 @@ void Render::pageRawDataReady(int page) for(int i=0;i= pagesReady.size()) + { + pagesEmited.clear(); return; //Oooops, something went wrong + } pagesReady[pagesEmited.at(i)] = true; if(pagesEmited.at(i) == currentIndex)