Browse Source

Merge pull request #7555 from stefandunca/pr-fix_segfault

Fix dangling pointer access
QGC4.4
Gus Grubba 6 years ago committed by GitHub
parent
commit
885656cbb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/Vehicle/Vehicle.cc

5
src/Vehicle/Vehicle.cc

@ -551,8 +551,11 @@ Vehicle::~Vehicle() @@ -551,8 +551,11 @@ Vehicle::~Vehicle()
void Vehicle::prepareDelete()
{
if(_cameras) {
delete _cameras;
// because of _cameras QML bindings check for nullptr won't work in the binding pipeline
// the dangling pointer access will cause a runtime fault
auto tmpCameras = _cameras;
_cameras = nullptr;
delete tmpCameras;
emit dynamicCamerasChanged();
qApp->processEvents();
}

Loading…
Cancel
Save