Skip to content

Commit

Permalink
Resolve event crasher.
Browse files Browse the repository at this point in the history
  • Loading branch information
krypton36 committed Jan 26, 2022
1 parent ea5612a commit adb1c5d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions examples/placeholder/linux/include/TestCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ 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 +85,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 adb1c5d

Please sign in to comment.