Qt程序崩溃问题集锦(持续更新...)

1. socket释放内存出错

现象

QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 0x0xe4b29a8. Receiver '' (of type 'QNativeSocketEngine') was created in thread 0x0xe4cabc8", file [kernel\qcoreapplication.cpp, line 563](kernel\qcoreapplication.cpp, line 563)

原因
socket是在线程中创建,而在析构时直接调用 delete m_socket 释放内存

解决办法
通过调用m_socket->deleteLater()来释放内存

你可能感兴趣的:(Qt程序崩溃问题集锦(持续更新...))