From adb1c5d0af2c7040088c70117fc084ca002b480a Mon Sep 17 00:00:00 2001 From: Joshua Villasenor Date: Wed, 26 Jan 2022 10:57:10 -0800 Subject: [PATCH 1/2] Resolve event crasher. --- examples/placeholder/linux/include/TestCommand.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/placeholder/linux/include/TestCommand.h b/examples/placeholder/linux/include/TestCommand.h index 40e111fc3cd737..b798f52a9ecbb1 100644 --- a/examples/placeholder/linux/include/TestCommand.h +++ b/examples/placeholder/linux/include/TestCommand.h @@ -66,6 +66,13 @@ 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 +85,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; } } From f281d0b8e26b8a548f44e2c3b3abc8c2086e0749 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 26 Jan 2022 20:42:49 +0000 Subject: [PATCH 2/2] Restyled by clang-format --- examples/placeholder/linux/include/TestCommand.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/placeholder/linux/include/TestCommand.h b/examples/placeholder/linux/include/TestCommand.h index b798f52a9ecbb1..25530628bf04ae 100644 --- a/examples/placeholder/linux/include/TestCommand.h +++ b/examples/placeholder/linux/include/TestCommand.h @@ -66,7 +66,8 @@ class TestCommand : public PICSChecker, public LogCommands return CHIP_NO_ERROR; } - static void ScheduleNextTest(intptr_t context){ + static void ScheduleNextTest(intptr_t context) + { TestCommand * command = reinterpret_cast(context); command->isRunning = true; command->NextTest();