Hello,

I have a problem with QSerialPort. Most of the time the below commands work fine, where rs485bus1 is a QSerialport pointer.

Qt Code:
  1. rs485bus1 = new QSerialPort(NULL);
  2.  
  3.  
  4. rs485bus1->setPortName("COM4");
  5. rs485bus1->setBaudRate(QSerialPort::Baud9600);
  6. rs485bus1->setDataBits(QSerialPort::Data8);
  7. rs485bus1->setParity(QSerialPort::NoParity);
  8. rs485bus1->setStopBits(QSerialPort::OneStop);
  9. rs485bus1->setFlowControl(QSerialPort::NoFlowControl);
  10.  
  11. if (err = rs485bus1->open(QIODevice::ReadWrite)) {std::cout<<"open"<<std::endl;}
  12. else{std::cout<<"fail open"<<std::endl;}
To copy to clipboard, switch view to plain text mode 

After which I'm succesfully able to write strings. The code is only called once before program exit.
At program exit, the port is closed. If the device is disconnected, the message "fail open" is
printed as expected.

However, once in a while when I run the program it crashes at rs485bus1->open(QIODevice::ReadWrite).
I'm not sure what causes it. Wierdly enough, after my program starts crashing at that point, the QT terminal
example starts to crash at the same spot (when trying to open the port). Extra strange to me, when I run
realTerm and exit, both my program and the terminal example run fine again.

I've tried using process explorer to search for the keyword serial, but nothing related comes up.
When using cdb for debugging, (which I've never used before) it tells me there's a stack overflow.

I'm using QT 5.7 on windows. I'm also using the EDSDK from Canon (maybe related?)

Since I don't know what the problem is it's difficult for me to reproduce.

Also first time poster, sorry if I've broken any rules I'll edit my post ASAP if need be. Thank you in advance