Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
4db32dd1
Unverified
Commit
4db32dd1
authored
Oct 18, 2020
by
Don Gagne
Committed by
GitHub
Oct 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent stale readBytes signalling to call into deleted objects (#9116)
parent
f6c22144
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
0 deletions
+8
-0
BluetoothLink.cc
src/comm/BluetoothLink.cc
+2
-0
SerialLink.cc
src/comm/SerialLink.cc
+2
-0
TCPLink.cc
src/comm/TCPLink.cc
+2
-0
UDPLink.cc
src/comm/UDPLink.cc
+2
-0
No files found.
src/comm/BluetoothLink.cc
View file @
4db32dd1
...
@@ -86,6 +86,8 @@ void BluetoothLink::disconnect(void)
...
@@ -86,6 +86,8 @@ void BluetoothLink::disconnect(void)
}
}
#endif
#endif
if
(
_targetSocket
)
{
if
(
_targetSocket
)
{
// This prevents stale signals from calling the link after it has been deleted
QObject
::
connect
(
_targetSocket
,
&
QBluetoothSocket
::
readyRead
,
this
,
&
BluetoothLink
::
readBytes
);
_targetSocket
->
deleteLater
();
_targetSocket
->
deleteLater
();
_targetSocket
=
nullptr
;
_targetSocket
=
nullptr
;
emit
disconnected
();
emit
disconnected
();
...
...
src/comm/SerialLink.cc
View file @
4db32dd1
...
@@ -79,6 +79,8 @@ void SerialLink::_writeBytes(const QByteArray data)
...
@@ -79,6 +79,8 @@ void SerialLink::_writeBytes(const QByteArray data)
void
SerialLink
::
disconnect
(
void
)
void
SerialLink
::
disconnect
(
void
)
{
{
if
(
_port
)
{
if
(
_port
)
{
// This prevents stale signals from calling the link after it has been deleted
QObject
::
disconnect
(
_port
,
&
QIODevice
::
readyRead
,
this
,
&
SerialLink
::
_readBytes
);
_port
->
close
();
_port
->
close
();
_port
->
deleteLater
();
_port
->
deleteLater
();
_port
=
nullptr
;
_port
=
nullptr
;
...
...
src/comm/TCPLink.cc
View file @
4db32dd1
...
@@ -106,6 +106,8 @@ void TCPLink::disconnect(void)
...
@@ -106,6 +106,8 @@ void TCPLink::disconnect(void)
quit
();
quit
();
wait
();
wait
();
if
(
_socket
)
{
if
(
_socket
)
{
// This prevents stale signal from calling the link after it has been deleted
QObject
::
connect
(
_socket
,
&
QTcpSocket
::
readyRead
,
this
,
&
TCPLink
::
readBytes
);
_socketIsConnected
=
false
;
_socketIsConnected
=
false
;
_socket
->
disconnectFromHost
();
// Disconnect tcp
_socket
->
disconnectFromHost
();
// Disconnect tcp
_socket
->
waitForDisconnected
();
_socket
->
waitForDisconnected
();
...
...
src/comm/UDPLink.cc
View file @
4db32dd1
...
@@ -222,6 +222,8 @@ void UDPLink::disconnect(void)
...
@@ -222,6 +222,8 @@ void UDPLink::disconnect(void)
quit
();
quit
();
wait
();
wait
();
if
(
_socket
)
{
if
(
_socket
)
{
// This prevents stale signal from calling the link after it has been deleted
QObject
::
disconnect
(
_socket
,
&
QUdpSocket
::
readyRead
,
this
,
&
UDPLink
::
readBytes
);
// Make sure delete happen on correct thread
// Make sure delete happen on correct thread
_socket
->
deleteLater
();
_socket
->
deleteLater
();
_socket
=
nullptr
;
_socket
=
nullptr
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment