Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for racy crash on opening bad serial port #12122

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Comms/SerialLink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ bool SerialLink::_hardwareConnect(QSerialPort::SerialPortError& error, QString&

_port = new QSerialPort(_serialConfig->portName(), this);

QObject::connect(_port, &QSerialPort::errorOccurred, this, &SerialLink::linkError);
QObject::connect(_port, &QIODevice::readyRead, this, &SerialLink::_readBytes);

// After the bootloader times out, it still can take a second or so for the Pixhawk USB driver to come up and make
// the port available for open. So we retry a few times to wait for it.
Expand Down Expand Up @@ -216,6 +214,9 @@ bool SerialLink::_hardwareConnect(QSerialPort::SerialPortError& error, QString&

emit connected();

QObject::connect(_port, &QSerialPort::errorOccurred, this, &SerialLink::linkError);
QObject::connect(_port, &QIODevice::readyRead, this, &SerialLink::_readBytes);

qCDebug(SerialLinkLog) << "Connection SeriaLink: " << "with settings" << _serialConfig->portName()
<< _serialConfig->baud() << _serialConfig->dataBits() << _serialConfig->parity() << _serialConfig->stopBits();

Expand Down
Loading