Details
-
Suggestion
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.13.0, 5.14.1
-
None
Description
After lots of painstaking months of efforts and workarounds, I found out that the `moveToThread()` idiom with `QTcpSocket` and `QWebSocketServer` doesn't work consistently across all the platforms. It may fail with Ubuntu at some time and with Mac at other times. In Windows, it's more stable, but depending on MinGW or MSVC, it crashes at undetermined places.
I have documented all my findings in this post: https://stackoverflow.com/a/60273596/514235
In brief, I suggest below in the following class bodies:
class QTcpServer / QTcpSocket / QWebSocketServer / QWebSocket : public QObject { Q_OBJECT ... // Create this object in a desired thread instead of moving at runtime private: void moveToThread (QThread*) = delete; // hiding `QObject::moveToThread()` };