Qt/C++/Valgrind 在 QTcpSocket 断开连接时读取大小为 8 无效
Qt/C++/Valgrind Invalid Readsize of 8 on QTcpSocket disconnect
我正在我的Qt/C++程序上运行valgrind,并收到此错误:
Invalid read of size 8
in TelnetConnection::disconnectClient() in telnetserver/telnetconnection.cpp:188
而 188 行是下面的等待断开行:
void TelnetConnection::disconnectClient()
{
tcpSocketPtr->disconnectFromHost();
tcpSocketPtr->waitForDisconnected();
}
我不完全确定此错误是什么意思,但是我该如何解决这个问题? 还是这超出了我的控制范围?(Qt问题(?
我不确定它是否相关,但我得到的唯一另一个错误是:
384 bytes in 1 blocks are possibly lost in loss record 5,342 of 5,972
in TelnetServer::incomingConnection(long long) in telnetserver/telnetserver.cpp:22
错误行是下面的 Start((:
void TelnetServer::incomingConnection(qintptr socketDescriptor)
{
TelnetConnection *thread = new TelnetConnection(socketDescriptor, this);
connect(thread, SIGNAL(shutdownRequested()), m_controller, SLOT(shutdownCommandIssued()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
connect(m_controller, SIGNAL(shutingdown()), thread, SLOT(shutdownConnection()));
thread->start();
}
再。。。此启动函数如何导致内存泄漏? 或者"可能丢失"这个词是否意味着它实际上没问题?
请参阅塞巴斯蒂安上面的评论以获取最佳答案。 基本上,读/写错误是由于即使在关闭套接字后仍继续向套接字发送流量(关闭不会停止所有流量(。 解决方案是在删除线程时删除套接字。
相关文章:
- 芬威克树(BIT).找到具有给定累积频率的最小索引,单位为 O(logN)
- 正在将csv文件读取为双精度矢量
- 为什么文件名被设置为一个点,而不是在读取矢量中的文件名时
- 从 std::stringstream 读取uint8_t为数字类型
- 搜索一组点,其长度总和最小为矩形.算法是什么
- 如何修复"在大小为 64 的块内读取大小为 8 - 40 字节的无效 free'd"
- 如何从c 中的文件中读取小endian整数
- 从二维数组中的char*初始化c++字符串时,读取大小为1的无效值
- 如何将多个字符读取合并为std::向量
- Qt/C++/Valgrind 在 QTcpSocket 断开连接时读取大小为 8 无效
- 读取C++#定义为Lua状态
- 读取大小为4的迭代器无效
- 使用valgrind读取大小为1的俄罗斯方块无效
- 速度控制在100Hz至10KHz范围内读取小记录从文件上的窗口
- 读取文件为32位二进制数据c++
- 无效的读取大小为8,但没有内存泄漏
- 在压入vector时读取大小为4的数据无效
- 无效的读取大小为1,新的操作符
- C++自定义读取函数为文件夹中的前两个文件返回错误的值
- cpp - valgrind -无效的读取大小为8