Hi @CodeFreaks
I would like to address your design. It is extremely confusing. It is great you are checking port existence.
Since you close them before you re-open them as-needed, I would 1) Not worry about doing new QSerialPort into a temp pointer and 2) connecting it at this point.
Just create a stack-instance (or use 'new'), do your check, close the port and if you used 'new' delete it right away. This will ensure you keep your resources clear and free. All you need to do is make your like of valid ports.
When you finally open the port for use, do your connect. This will ensure your signal and its sender are valid. Doing your connect on the temp pointer (which you delete) frees that connection. Once you are sure you have your ports opened correctly you can use sender () in your slot as follows:
QSerialPort* port = dynamic_cast <QSerialPort*> (sender ()); // You can also use qobject_cast
if (port) {
...
}
I use multiple ports with auto-baud detection constantly along with CAN and UDP so you are close and you have no fear! This is all good.