oliver_mpt
5th February 2018, 14:10
Hi !
I have a strange bug that I can't track down :
I have a qt server which receive, using a TCPclient class, a text file sent line by line by a remote client device. Every line of text is stored, upon reception in a QStringList variable, which is a member variable of the MainWindow main class of the application. This variable is declared as public and is written directly from the TcpClient class, which holds a pointer m_mainWnd to the MainWindow class. The code snippet from TcpClient class which receive the line is given below :
case TCP_HARDWARE_CONFIG_LINE:
{
char* p = new char[m_blockSize];
in.readRawData(p, m_blockSize - 4);
QString sconf = QString::fromUtf8(p);
if (!sconf.isEmpty()) m_mainWnd->m_listConfig.append(sconf);
delete p;
}
break;
When executing the m_listConfig.append, a segmentation fault (SIGSEV) is raised. The string sconf is perfectly valid, but the debugger states "no such value" when I set an expression evaluator to my m_mainWnd pointer.
The MainWindow class header is included in the TcpClient.h file, the compiler doesn't complain nor show warnings.
Any idea why my MainWindow pointer is invalid ?
I have a strange bug that I can't track down :
I have a qt server which receive, using a TCPclient class, a text file sent line by line by a remote client device. Every line of text is stored, upon reception in a QStringList variable, which is a member variable of the MainWindow main class of the application. This variable is declared as public and is written directly from the TcpClient class, which holds a pointer m_mainWnd to the MainWindow class. The code snippet from TcpClient class which receive the line is given below :
case TCP_HARDWARE_CONFIG_LINE:
{
char* p = new char[m_blockSize];
in.readRawData(p, m_blockSize - 4);
QString sconf = QString::fromUtf8(p);
if (!sconf.isEmpty()) m_mainWnd->m_listConfig.append(sconf);
delete p;
}
break;
When executing the m_listConfig.append, a segmentation fault (SIGSEV) is raised. The string sconf is perfectly valid, but the debugger states "no such value" when I set an expression evaluator to my m_mainWnd pointer.
The MainWindow class header is included in the TcpClient.h file, the compiler doesn't complain nor show warnings.
Any idea why my MainWindow pointer is invalid ?