Skip to content

Commit

Permalink
[ESP32] fix the unsafe access to chip stack in lock-app (project-chip…
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamdp authored Dec 22, 2023
1 parent cd815ef commit 1939c35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions examples/lock-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ CHIP_ERROR AppTask::Init()

sLockLED.Set(!BoltLockMgr().IsUnlocked());

chip::DeviceLayer::SystemLayer().ScheduleWork(UpdateClusterState, nullptr);
chip::DeviceLayer::PlatformMgr().ScheduleWork(UpdateClusterState, reinterpret_cast<intptr_t>(nullptr));

ConfigurationMgr().LogDeviceConfig();

Expand Down Expand Up @@ -424,7 +424,7 @@ void AppTask::ActionCompleted(BoltLockManager::Action_t aAction)
}
if (sAppTask.mSyncClusterToButtonAction)
{
chip::DeviceLayer::SystemLayer().ScheduleWork(UpdateClusterState, nullptr);
chip::DeviceLayer::PlatformMgr().ScheduleWork(UpdateClusterState, reinterpret_cast<intptr_t>(nullptr));
sAppTask.mSyncClusterToButtonAction = false;
}
}
Expand Down Expand Up @@ -463,7 +463,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent)
}

/* if unlocked then it locked it first*/
void AppTask::UpdateClusterState(chip::System::Layer *, void * context)
void AppTask::UpdateClusterState(intptr_t context)
{
uint8_t newValue = !BoltLockMgr().IsUnlocked();

Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/esp32/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class AppTask
static void LockActionEventHandler(AppEvent * aEvent);
static void TimerEventHandler(TimerHandle_t xTimer);

static void UpdateClusterState(chip::System::Layer *, void * context);
static void UpdateClusterState(intptr_t context);

void StartTimer(uint32_t aTimeoutMs);

Expand Down

0 comments on commit 1939c35

Please sign in to comment.