mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-14 09:51:36 +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:
@@ -58,8 +58,6 @@ PWMSim::PWMSim(bool hil_mode_enabled) :
|
||||
void
|
||||
PWMSim::Run()
|
||||
{
|
||||
SmartLock lock_guard(_lock);
|
||||
|
||||
if (should_exit()) {
|
||||
ScheduleClear();
|
||||
_mixing_output.unregister();
|
||||
@@ -68,6 +66,8 @@ PWMSim::Run()
|
||||
return;
|
||||
}
|
||||
|
||||
SmartLock lock_guard(_lock);
|
||||
|
||||
_mixing_output.update();
|
||||
|
||||
// check for parameter updates
|
||||
|
||||
Reference in New Issue
Block a user