diff --git a/examples/placeholder/linux/include/TestCommand.h b/examples/placeholder/linux/include/TestCommand.h index 40e111fc3cd737..25530628bf04ae 100644 --- a/examples/placeholder/linux/include/TestCommand.h +++ b/examples/placeholder/linux/include/TestCommand.h @@ -66,6 +66,14 @@ class TestCommand : public PICSChecker, public LogCommands return CHIP_NO_ERROR; } + static void ScheduleNextTest(intptr_t context) + { + TestCommand * command = reinterpret_cast(context); + command->isRunning = true; + command->NextTest(); + chip::DeviceLayer::PlatformMgr().RemoveEventHandler(OnPlatformEvent, context); + } + CHIP_ERROR WaitForCommissioning() { isRunning = false; @@ -78,11 +86,7 @@ class TestCommand : public PICSChecker, public LogCommands { case chip::DeviceLayer::DeviceEventType::kCommissioningComplete: ChipLogProgress(chipTool, "Commissioning complete"); - - TestCommand * command = reinterpret_cast(arg); - command->isRunning = true; - command->NextTest(); - chip::DeviceLayer::PlatformMgr().RemoveEventHandler(OnPlatformEvent, arg); + chip::DeviceLayer::PlatformMgr().ScheduleWork(ScheduleNextTest, arg); break; } }