mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 03:26:50 +08:00
mavlink: properly cleanup instance on exit
This commit is contained in:
@@ -147,6 +147,10 @@ Mavlink::~Mavlink()
|
|||||||
} while (_task_running);
|
} while (_task_running);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_instance_id >= 0) {
|
||||||
|
mavlink_module_instances[_instance_id] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
perf_free(_loop_perf);
|
perf_free(_loop_perf);
|
||||||
perf_free(_loop_interval_perf);
|
perf_free(_loop_interval_perf);
|
||||||
perf_free(_send_byte_error_perf);
|
perf_free(_send_byte_error_perf);
|
||||||
@@ -2546,6 +2550,8 @@ Mavlink::task_main(int argc, char *argv[])
|
|||||||
|
|
||||||
pthread_mutex_destroy(&_send_mutex);
|
pthread_mutex_destroy(&_send_mutex);
|
||||||
|
|
||||||
|
_task_running = false;
|
||||||
|
|
||||||
PX4_INFO("exiting channel %i", (int)_channel);
|
PX4_INFO("exiting channel %i", (int)_channel);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MavlinkReceiver _receiver;
|
MavlinkReceiver _receiver;
|
||||||
int _instance_id{0};
|
int _instance_id{-1};
|
||||||
|
|
||||||
bool _transmitting_enabled{true};
|
bool _transmitting_enabled{true};
|
||||||
bool _transmitting_enabled_commanded{false};
|
bool _transmitting_enabled_commanded{false};
|
||||||
|
|||||||
Reference in New Issue
Block a user