mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 11:06:04 +08:00
camera_capture: disable timer callback on stop
Otherwise the capture_trampoline is called while g_camera_capture is a nullptr, which leads to a hardfault since the this pointer is invalid.
This commit is contained in:
committed by
Daniel Agar
parent
016db84d69
commit
98a35971af
@@ -226,7 +226,9 @@ void
|
|||||||
CameraCapture::capture_trampoline(void *context, uint32_t chan_index, hrt_abstime edge_time, uint32_t edge_state,
|
CameraCapture::capture_trampoline(void *context, uint32_t chan_index, hrt_abstime edge_time, uint32_t edge_state,
|
||||||
uint32_t overflow)
|
uint32_t overflow)
|
||||||
{
|
{
|
||||||
camera_capture::g_camera_capture->capture_callback(chan_index, edge_time, edge_state, overflow);
|
if (camera_capture::g_camera_capture) {
|
||||||
|
camera_capture::g_camera_capture->capture_callback(chan_index, edge_time, edge_state, overflow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -359,6 +361,11 @@ CameraCapture::stop()
|
|||||||
|
|
||||||
work_cancel(HPWORK, &_work_publisher);
|
work_cancel(HPWORK, &_work_publisher);
|
||||||
|
|
||||||
|
if (_capture_channel >= 0) {
|
||||||
|
up_input_capture_set(_capture_channel, Disabled, 0, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (camera_capture::g_camera_capture != nullptr) {
|
if (camera_capture::g_camera_capture != nullptr) {
|
||||||
delete (camera_capture::g_camera_capture);
|
delete (camera_capture::g_camera_capture);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user