Worker task wrapper lambda needs to be mutable so its captured task can be moved from properly.

This commit is contained in:
Mat Sutcliffe
2018-10-24 22:36:31 +01:00
committed by Klaus Basan
parent cf5a807bc6
commit cf92fbeb03

View File

@@ -224,7 +224,7 @@ namespace BlackMisc
static CWorker *fromTask(QObject *owner, const QString &name, F &&task)
{
int typeId = qMetaTypeId<std::decay_t<decltype(std::forward<F>(task)())>>();
return fromTaskImpl(owner, name, typeId, [task = std::forward<F>(task)]() { return CVariant::fromResultOf(std::move(task)); });
return fromTaskImpl(owner, name, typeId, [task = std::forward<F>(task)]() mutable { return CVariant::fromResultOf(std::move(task)); });
}
//! Connects to a functor to which will be passed the result when the task is finished.