[app] Set target thread for HashTask

This commit is contained in:
Slava Monich 2018-05-17 20:15:29 +03:00
parent 6c62bad2a7
commit cfcb0b7fbc
2 changed files with 5 additions and 6 deletions

View file

@ -300,7 +300,7 @@ void BooksBook::GuessCoverTask::performTask()
class BooksBook::HashTask : public HarbourTask class BooksBook::HashTask : public HarbourTask
{ {
public: public:
HashTask(QThreadPool* aPool, QString aPath); HashTask(QThreadPool* aPool, QThread* aTargetThread, QString aPath);
virtual void performTask(); virtual void performTask();
@ -309,8 +309,8 @@ public:
QByteArray iHash; QByteArray iHash;
}; };
BooksBook::HashTask::HashTask(QThreadPool* aPool, QString aPath) : BooksBook::HashTask::HashTask(QThreadPool* aPool, QThread* aTargetThread,
HarbourTask(aPool), iPath(aPath) QString aPath) : HarbourTask(aPool, aTargetThread), iPath(aPath)
{ {
} }
@ -390,8 +390,7 @@ BooksBook::BooksBook(const BooksStorage& aStorage, QString aRelativePath,
if (iHash.isEmpty()) { if (iHash.isEmpty()) {
HDEBUG("need to calculate hash for" << qPrintable(iPath)); HDEBUG("need to calculate hash for" << qPrintable(iPath));
iHashTaskQueue = BooksTaskQueue::hashQueue(); iHashTaskQueue = BooksTaskQueue::hashQueue();
iHashTask = new HashTask(iHashTaskQueue->pool(), iPath); iHashTask = new HashTask(iHashTaskQueue->pool(), thread(), iPath);
iHashTask->moveToThread(thread());
iHashTask->submit(this, SLOT(onHashTaskDone())); iHashTask->submit(this, SLOT(onHashTaskDone()));
} }
// Refcounted BooksBook objects are managed by C++ code // Refcounted BooksBook objects are managed by C++ code

@ -1 +1 @@
Subproject commit b0fda2fea0c7381d74bf848902c48cbbcd3f6a8e Subproject commit 7574d4159407022dff5eb7ccbc805048a8f61b51