mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 01:13:33 +08:00
output drivers: init SmartLock after exit_and_cleanup
This fixes an invalid memory access when exiting the module: exit_and_cleanup destroys the object, but lock_guard is destructed after and accesses the lock.
This commit is contained in:
@@ -376,8 +376,6 @@ bool PCA9685Wrapper::updateOutputs(bool stop_motors, uint16_t *outputs, unsigned
|
||||
|
||||
void PCA9685Wrapper::Run()
|
||||
{
|
||||
SmartLock lock_guard(_lock);
|
||||
|
||||
if (should_exit()) {
|
||||
ScheduleClear();
|
||||
_mixing_output.unregister();
|
||||
@@ -391,6 +389,8 @@ void PCA9685Wrapper::Run()
|
||||
return;
|
||||
}
|
||||
|
||||
SmartLock lock_guard(_lock);
|
||||
|
||||
perf_begin(_cycle_perf);
|
||||
|
||||
switch (_state) {
|
||||
|
||||
Reference in New Issue
Block a user