From e5526de0af47ee88fd1f18971fe110a13608fd1f Mon Sep 17 00:00:00 2001 From: Felix Kauselmann Date: Thu, 4 Mar 2021 16:45:52 +0100 Subject: [PATCH] Render: Protect against race condition in setNumPages (#220) * Render: Use sendPostedEvents to force processing of queued events when removing old comic objects --- YACReader/render.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/YACReader/render.cpp b/YACReader/render.cpp index ef937088..4e6f5a4f 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -695,13 +695,12 @@ void Render::createComic(const QString &path) pagesEmited.clear(); if (comic != nullptr) { - //comic->moveToThread(QApplication::instance()->thread()); comic->invalidate(); - comic->disconnect(); + // Dispatch pending events to guard against race conditons + QCoreApplication::sendPostedEvents(this); comic->deleteLater(); } - //comic->moveToThread(QApplication::instance()->thread()); comic = FactoryComic::newComic(path); if (comic == nullptr) //archivo no encontrado o no vĂ¡lido