mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Assert earlier when thenWithResult type doesn't match lambda return type.
This commit is contained in:
@@ -13,11 +13,13 @@
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
CWorker *CWorker::fromTaskImpl(QObject *owner, const QString &name, std::function<CVariant()> task)
|
||||
CWorker *CWorker::fromTaskImpl(QObject *owner, const QString &name, int typeId, std::function<CVariant()> task)
|
||||
{
|
||||
auto *thread = new CRegularThread(owner);
|
||||
auto *worker = new CWorker(task);
|
||||
|
||||
if (typeId != QMetaType::Void) { worker->m_result = CVariant(typeId, nullptr); }
|
||||
|
||||
QString ownerName = owner->objectName().isEmpty() ? owner->metaObject()->className() : owner->objectName();
|
||||
thread->setObjectName(ownerName + ":" + name);
|
||||
worker->setObjectName(name);
|
||||
|
||||
Reference in New Issue
Block a user