Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8.2
-
Arch Linux Latest.
-
-
Foundation PM Staging
Description
I have code that has 3 errorOccurred handlers attached.
private slots: // Slots for handling events void handleUnitSerialError(QSerialPort::SerialPortError error); void handleReferenceSerialError(QSerialPort::SerialPortError error); void handleChilledMirrorSerialError(QSerialPort::SerialPortError error); QSerialPort *unitSerial; QSerialPort *referenceSerial; QSerialPort *chilledMirrorSerial; Serial::Serial(QObject *parent) : QObject(parent), unitSerial(new QSerialPort(this)), referenceSerial(new QSerialPort(this)), chilledMirrorSerial(new QSerialPort(this)), referenceCommandTimer(new QTimer(this)), chilledMirrorCommandTimer(new QTimer(this)), m_pauseLog(false) { // Connect readyRead signals connect(unitSerial, &QSerialPort::readyRead, this, &Serial::readUnitData); connect(referenceSerial, &QSerialPort::readyRead, this, &Serial::readReferenceData); // Connect individual errorOccurred signals to specific slots connect(unitSerial, &QSerialPort::errorOccurred, this, &Serial::handleUnitSerialError); connect(referenceSerial, &QSerialPort::errorOccurred, this, &Serial::handleReferenceSerialError); connect(chilledMirrorSerial, &QSerialPort::errorOccurred, this, &Serial::handleChilledMirrorSerialError); void Serial::handleUnitSerialError(QSerialPort::SerialPortError error) { qDebug() << "handleUnitSerialError triggered with error:" << error; if (error == QSerialPort::NoError) return; if (error == QSerialPort::ResourceError) { qDebug() << "Critical resource error. Closing unit serial port."; closeUnitSerialPort(); } } void Serial::handleReferenceSerialError(QSerialPort::SerialPortError error) { qDebug() << "ReferenceSerialError triggered with error:" << error; if (error == QSerialPort::NoError) return; if (error == QSerialPort::ResourceError) { qDebug() << "Critical resource error. Closing reference serial port."; closeReferenceSerialPort(); } } void Serial::handleChilledMirrorSerialError(QSerialPort::SerialPortError error) { if (error == QSerialPort::NoError) return; if (error == QSerialPort::ResourceError) { qDebug() << "Critical resource error. Closing chilled mirror serial port."; closeChilledMirrorSerialPort(); } // Add additional handling specific to chilledMirrorSerial if necessary }
For whatever reason, I am able to get ResourceError fired when I unplug both the chilledMirror and reference serial ports. But I cannot get unitSerial to fire ResourceError when I unplug the USB from the computer.
This code started working when I upgraded to 6.8.2 from 6.8.1. I noticed that there are bug fixes for QtSerialPort in the release notes that helped implement this fix automatically when I upgraded.
I am not sure how to debug this. The engine will not give me ResourceError for unit for whatever reason.