Skip to content

Commit

Permalink
Fix Engine::ScheduleRun() in case callback funtion done before system…
Browse files Browse the repository at this point in the history
…Layer->ScheduleWork() returns. (project-chip#14596)

- setup mRunScheduled = true before execute ScheduleWork()
  • Loading branch information
lnikulin committed Feb 2, 2022
1 parent 63a5c52 commit b8d9553
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/reporting/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,13 @@ CHIP_ERROR Engine::ScheduleRun()
{
return CHIP_ERROR_INCORRECT_STATE;
}
ReturnErrorOnFailure(systemLayer->ScheduleWork(Run, this));
mRunScheduled = true;
return CHIP_NO_ERROR;
auto err = systemLayer->ScheduleWork(Run, this);
if (!::chip::ChipError::IsSuccess(err))
{
mRunScheduled = false;
}
return err;
}

void Engine::Run()
Expand Down

0 comments on commit b8d9553

Please sign in to comment.