forked from mavlink/MAVSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mavsdk_server: fix crash on stop/destruction (mavlink#2417)
This fixes a segfault which happens when the mavsdk_server is stopped and destroyed before every having discovered any autopilot. What happened is that: 1. ConnectionInitiator would be cancelled. 2. ConnectionInitiator would be destructed. 3. And only now the connect thread would wake up from sleeping and read the _should_exit flag which at this point has been destroyed. At this point the connect function would try to access Mavsdk::systems() which is also destructed by that point and cause a segfault. The fix is to wrap the ConnectionInitiator class in a shared ptr and keep that one alive in the connect function to avoid destruction until it has returned.
- Loading branch information
1 parent
d7806a7
commit a80dea9
Showing
2 changed files
with
12 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters