Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
qt connect crashing app
I am going crazy with a simple connect signal and slot. I have this function startDataMonitoring() which is called from another class (GUI class). Stockert70 is not a GUI class but is used as a simple driver for communication with serial port.
qDebug() << m_pSerialPort->portName();
//connected to serial port
connect(m_pSerialPort, &QSerialPort::readyRead, this, &Stockert70::handleReadyRead);
When I call this function on a button click I get this error:
"COM6" <--- this is a serial port name read from m_pSerialPort object so it is valid.
Exception thrown at 0x00000000604E2D02 (Qt5Cored.dll) in QStockertSerialPort.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
m_pSerialPort is initialized in another function that is called before this startDataMonitoring() function.
void Stockert70::setSerialPortParameters(QString portName)
qDebug() << "Set serial port parameters!";
m_pSerialPort = new QSerialPort();
Kent-Dorfman last edited by Kent-Dorfman
Well, you've got a null pointer somewhere. That much is ovbious. OK..."poorly initialize pointer" would be the better description.
And don't do serial comms without flow control. That makes me grind my teeth.
@kent-dorfman Yeh but where? m_pSerialPort is not null
@zgembo Found out. Stupid mistake. I have creted in .h file a pointe Stockert70 *stockert; and in .cpp I copy and pasted
Stockert70 *stockert = new Stockert70(this);
Lost a day on this.