Commit a84be5e6 authored by Otavio Pontes's avatar Otavio Pontes

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.
parent f1b82fb9
...@@ -80,7 +80,7 @@ void VideoReceiver::_connected() ...@@ -80,7 +80,7 @@ void VideoReceiver::_connected()
{ {
//-- Server showed up. Now we start the stream. //-- Server showed up. Now we start the stream.
_timer.stop(); _timer.stop();
delete _socket; _socket->deleteLater();
_socket = NULL; _socket = NULL;
_serverPresent = true; _serverPresent = true;
start(); start();
...@@ -91,7 +91,7 @@ void VideoReceiver::_connected() ...@@ -91,7 +91,7 @@ void VideoReceiver::_connected()
void VideoReceiver::_socketError(QAbstractSocket::SocketError socketError) void VideoReceiver::_socketError(QAbstractSocket::SocketError socketError)
{ {
Q_UNUSED(socketError); Q_UNUSED(socketError);
delete _socket; _socket->deleteLater();
_socket = NULL; _socket = NULL;
//-- Try again in 5 seconds //-- Try again in 5 seconds
_timer.start(5000); _timer.start(5000);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment