Skip to content

Commit

Permalink
Resolve event crasher. (#14355)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh V [Apple] authored and pull[bot] committed Jan 25, 2024
1 parent f7fe3f9 commit 1543072
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions examples/placeholder/linux/include/TestCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ class TestCommand : public PICSChecker, public LogCommands
return CHIP_NO_ERROR;
}

static void ScheduleNextTest(intptr_t context)
{
TestCommand * command = reinterpret_cast<TestCommand *>(context);
command->isRunning = true;
command->NextTest();
chip::DeviceLayer::PlatformMgr().RemoveEventHandler(OnPlatformEvent, context);
}

CHIP_ERROR WaitForCommissioning()
{
isRunning = false;
Expand All @@ -78,11 +86,7 @@ class TestCommand : public PICSChecker, public LogCommands
{
case chip::DeviceLayer::DeviceEventType::kCommissioningComplete:
ChipLogProgress(chipTool, "Commissioning complete");

TestCommand * command = reinterpret_cast<TestCommand *>(arg);
command->isRunning = true;
command->NextTest();
chip::DeviceLayer::PlatformMgr().RemoveEventHandler(OnPlatformEvent, arg);
chip::DeviceLayer::PlatformMgr().ScheduleWork(ScheduleNextTest, arg);
break;
}
}
Expand Down

0 comments on commit 1543072

Please sign in to comment.