Skip to content

Conversation

@rubenp02
Copy link
Contributor

@rubenp02 rubenp02 commented Jun 3, 2025

Terrain: Fix TerrainQuery crash

Description

This fixes a use-after-free crash caused by improper raw pointer usage in TerrainQuery.

Key changes:

  • Replace raw TerrainAtCoordinateQuery pointers with QPointer to automatically track object lifetime.
  • Remove manual destroyed signal handling and related cleanup code.

In addition to this, some no-op logic has been removed.

Test Steps

Connect a real APM vehicle with a mission of around 300 waypoints. The application will often crash after loading the mission and drawing the plan.

Checklist:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

rubenp02 added 2 commits June 3, 2025 16:55
This fixes a use-after-free crash caused by improper raw pointer usage
in TerrainQuery.

Key changes:
- Replace raw TerrainAtCoordinateQuery pointers with QPointer to
  automatically track object lifetime.
- Remove manual destroyed signal handling and related cleanup code.
@rubenp02 rubenp02 changed the title Fix TerrainQuery crash Terrain: Fix TerrainQuery crash Jun 3, 2025
@HTRamsey HTRamsey merged commit f3deca2 into mavlink:master Jun 5, 2025
11 checks passed
@rubenp02 rubenp02 deleted the bugfix/fix-terrainquery-crash branch June 6, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants