Browse Source

fix PX4AutoPilotPlugin: avoid memory leaks

QGC4.4
Beat Küng 4 years ago committed by Lorenz Meier
parent
commit
7bca160575
  1. 24
      src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc

24
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc

@ -63,54 +63,54 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void) @@ -63,54 +63,54 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void)
if (_components.count() == 0 && !_incorrectParameterVersion) {
if (_vehicle) {
if (_vehicle->parameterManager()->parametersReady()) {
_airframeComponent = new AirframeComponent(_vehicle, this);
_airframeComponent = new AirframeComponent(_vehicle, this, this);
_airframeComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_airframeComponent));
_sensorsComponent = new SensorsComponent(_vehicle, this);
_sensorsComponent = new SensorsComponent(_vehicle, this, this);
_sensorsComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent));
_radioComponent = new PX4RadioComponent(_vehicle, this);
_radioComponent = new PX4RadioComponent(_vehicle, this, this);
_radioComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_radioComponent));
_flightModesComponent = new FlightModesComponent(_vehicle, this);
_flightModesComponent = new FlightModesComponent(_vehicle, this, this);
_flightModesComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_flightModesComponent));
_powerComponent = new PowerComponent(_vehicle, this);
_powerComponent = new PowerComponent(_vehicle, this, this);
_powerComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_powerComponent));
_motorComponent = new MotorComponent(_vehicle, this);
_motorComponent = new MotorComponent(_vehicle, this, this);
_motorComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_motorComponent));
_safetyComponent = new SafetyComponent(_vehicle, this);
_safetyComponent = new SafetyComponent(_vehicle, this, this);
_safetyComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_safetyComponent));
_tuningComponent = new PX4TuningComponent(_vehicle, this);
_tuningComponent = new PX4TuningComponent(_vehicle, this, this);
_tuningComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent));
if(_vehicle->parameterManager()->parameterExists(_vehicle->id(), "SYS_VEHICLE_RESP")) {
_flightBehavior = new PX4FlightBehavior(_vehicle, this);
_flightBehavior = new PX4FlightBehavior(_vehicle, this, this);
_flightBehavior->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_flightBehavior));
}
//-- Is there support for cameras?
if(_vehicle->parameterManager()->parameterExists(_vehicle->id(), "TRIG_MODE")) {
_cameraComponent = new CameraComponent(_vehicle, this);
_cameraComponent = new CameraComponent(_vehicle, this, this);
_cameraComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_cameraComponent));
}
//-- Is there an ESP8266 Connected?
if(_vehicle->parameterManager()->parameterExists(MAV_COMP_ID_UDP_BRIDGE, "SW_VER")) {
_esp8266Component = new ESP8266Component(_vehicle, this);
_esp8266Component = new ESP8266Component(_vehicle, this, this);
_esp8266Component->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_esp8266Component));
}
@ -119,7 +119,7 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void) @@ -119,7 +119,7 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void)
}
if(_vehicle->parameterManager()->parameterExists(_vehicle->id(), "SLNK_RADIO_CHAN")) {
_syslinkComponent = new SyslinkComponent(_vehicle, this);
_syslinkComponent = new SyslinkComponent(_vehicle, this, this);
_syslinkComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_syslinkComponent));
}

Loading…
Cancel
Save