From b31da67dd3267dfb05b559a7a4b790b607876653 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Mon, 28 Sep 2020 05:17:58 +0300 Subject: [PATCH] [app] Explicitly set thread affinity for RenderTask BooksPageWidget::paint() isn't necessarily called on the main GUI thread. --- app/src/BooksPageWidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/BooksPageWidget.cpp b/app/src/BooksPageWidget.cpp index 1c035c5..0a18bc3 100644 --- a/app/src/BooksPageWidget.cpp +++ b/app/src/BooksPageWidget.cpp @@ -140,8 +140,8 @@ void BooksPageWidget::ResetTask::performTask() class BooksPageWidget::RenderTask : public HarbourTask { public: - RenderTask(QThreadPool* aPool, Data::Ptr aData, - int aWidth, int aHeight) : HarbourTask(aPool), + RenderTask(QThreadPool* aPool, QThread* aTargetThread, Data::Ptr aData, + int aWidth, int aHeight) : HarbourTask(aPool, aTargetThread), iData(aData), iWidth(aWidth), iHeight(aHeight) {} void performTask(); @@ -754,8 +754,8 @@ void BooksPageWidget::scheduleRepaint() if (w > 0 && h > 0 && !iData.isNull() && !iData->iView.isNull()) { const shared_ptr view(iData->iView); view->setInvertColors(iSettings->invertColors()); - (iRenderTask = new RenderTask(iTaskQueue->pool(), iData, w, h))-> - submit(this, SLOT(onRenderTaskDone())); + (iRenderTask = new RenderTask(iTaskQueue->pool(), thread(), + iData, w, h))->submit(this, SLOT(onRenderTaskDone())); } else { update(); }