From a84be5e64fc4e1cb8b39a4410a41d54fedd94bd8 Mon Sep 17 00:00:00 2001 From: Otavio Pontes Date: Thu, 19 Jan 2017 16:39:50 -0800 Subject: [PATCH] Fix crash by invalid socket deletion Calling delete on a socket callback is not safe and this can crash QGroundControl. Using deleteLater method from socket to perfom deletion. --- src/VideoStreaming/VideoReceiver.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VideoStreaming/VideoReceiver.cc b/src/VideoStreaming/VideoReceiver.cc index 594a028f0..8631f174c 100644 --- a/src/VideoStreaming/VideoReceiver.cc +++ b/src/VideoStreaming/VideoReceiver.cc @@ -80,7 +80,7 @@ void VideoReceiver::_connected() { //-- Server showed up. Now we start the stream. _timer.stop(); - delete _socket; + _socket->deleteLater(); _socket = NULL; _serverPresent = true; start(); @@ -91,7 +91,7 @@ void VideoReceiver::_connected() void VideoReceiver::_socketError(QAbstractSocket::SocketError socketError) { Q_UNUSED(socketError); - delete _socket; + _socket->deleteLater(); _socket = NULL; //-- Try again in 5 seconds _timer.start(5000); -- 2.22.0