Skip to content

Commit

Permalink
Resolve event crasher. (project-chip#14355)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh V [Apple] authored and selissia committed Jan 28, 2022
1 parent c28631e commit 48ffe1b
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 48ffe1b

Please sign in to comment.