From 246879228ff5a473b3b5aecea6d654ae92cef926 Mon Sep 17 00:00:00 2001 From: Joshua Villasenor Date: Mon, 20 Mar 2023 14:09:04 -0700 Subject: [PATCH] Resolve race condition before UserPrompt in simulated tests. (#25576) --- examples/placeholder/linux/include/TestCommand.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/placeholder/linux/include/TestCommand.h b/examples/placeholder/linux/include/TestCommand.h index b9204f2d6702b9..7bd4d3b6e8497b 100644 --- a/examples/placeholder/linux/include/TestCommand.h +++ b/examples/placeholder/linux/include/TestCommand.h @@ -111,7 +111,6 @@ class TestCommand : public TestRunner, TestCommand * command = reinterpret_cast(context); command->isRunning = true; command->NextTest(); - chip::DeviceLayer::PlatformMgr().RemoveEventHandler(OnPlatformEvent, context); } static void OnPlatformEvent(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg) @@ -121,6 +120,7 @@ class TestCommand : public TestRunner, case chip::DeviceLayer::DeviceEventType::kCommissioningComplete: ChipLogProgress(chipTool, "Commissioning complete"); chip::DeviceLayer::PlatformMgr().ScheduleWork(ScheduleNextTest, arg); + chip::DeviceLayer::PlatformMgr().RemoveEventHandler(OnPlatformEvent, arg); break; } } @@ -129,7 +129,7 @@ class TestCommand : public TestRunner, { if (commandPath == mCommandPath) { - NextTest(); + chip::DeviceLayer::PlatformMgr().ScheduleWork(ScheduleNextTest, reinterpret_cast(this)); return; } @@ -141,7 +141,7 @@ class TestCommand : public TestRunner, { if (attributePath == mAttributePath) { - NextTest(); + chip::DeviceLayer::PlatformMgr().ScheduleWork(ScheduleNextTest, reinterpret_cast(this)); return; }