TaskTree: Change the signature of storage handlers

The handlers for TaskTree::onStorage{Setup,Done}(...)
took a pointer to the storage struct. Take a reference instead.
This is in line with tasks setup/done/error handlers.

Change-Id: I8ff18c250f0fbbcd8210ec304e34232e842831fc
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2023-08-31 18:31:34 +02:00
parent 7730a329a3
commit 197a45b9b9
2 changed files with 6 additions and 6 deletions

View File

@@ -437,7 +437,7 @@ private:
StorageVoidHandler wrapHandler(StorageHandler &&handler) {
return [=](void *voidStruct) {
StorageStruct *storageStruct = static_cast<StorageStruct *>(voidStruct);
std::invoke(handler, storageStruct);
std::invoke(handler, *storageStruct);
};
}

View File

@@ -550,8 +550,8 @@ void tst_Tasking::testTree_data()
};
taskTree.setRecipe(nestedRoot);
CustomStorage *activeStorage = storage.activeStorage();
auto collectSubLog = [activeStorage](CustomStorage *subTreeStorage){
activeStorage->m_log += subTreeStorage->m_log;
const auto collectSubLog = [activeStorage](CustomStorage &subTreeStorage){
activeStorage->m_log += subTreeStorage.m_log;
};
taskTree.onStorageDone(storage, collectSubLog);
};
@@ -2244,7 +2244,7 @@ void tst_Tasking::testTree()
TaskTree taskTree({testData.root.withTimeout(1000ms)});
QCOMPARE(taskTree.taskCount() - 1, testData.taskCount); // -1 for the timeout task above
Log actualLog;
const auto collectLog = [&actualLog](CustomStorage *storage) { actualLog = storage->m_log; };
const auto collectLog = [&actualLog](CustomStorage &storage) { actualLog = storage.m_log; };
taskTree.onStorageDone(testData.storage, collectLog);
const OnDone result = taskTree.runBlocking() ? OnDone::Success : OnDone::Failure;
QCOMPARE(taskTree.isRunning(), false);
@@ -2274,11 +2274,11 @@ void tst_Tasking::storageOperators()
void tst_Tasking::storageDestructor()
{
bool setupCalled = false;
const auto setupHandler = [&setupCalled](CustomStorage *) {
const auto setupHandler = [&setupCalled](CustomStorage &) {
setupCalled = true;
};
bool doneCalled = false;
const auto doneHandler = [&doneCalled](CustomStorage *) {
const auto doneHandler = [&doneCalled](CustomStorage &) {
doneCalled = true;
};
QCOMPARE(CustomStorage::instanceCount(), 0);