Am 27.05.2015 um 15:49 schrieb Jérôme Godbout:
Before making the moveToThread(), remove the parent of the object,
->setParent(nullptr);
Once moved, you can reparent with object into that Thread.

The QWebSocketServer does not have a parent. The problem does not occur with this class itself, but with QNativeSocketEngine, which seems to exist somewhere in the depth of Qt.

The QNativeSocketEngine was created by Qt internals in the GUI thread context, but is now used by the QWebSocketServer which lives in a separate thread. Seems these two classes do not expect this to happen...

[...]
On Wed, May 27, 2015 at 3:43 AM, Rainer Wiesenfarth
<[email protected] <mailto:[email protected]>>
wrote:

    (Qt 5.3.2 Windows msvc-2010 64bit)

    I would like to add a QWebSocketServer to an existing application. I
    would like to have all its operation handled by a thread different
    from the GUI thread to get communication separated from the GUI part.

    However, when I use moveToThread with the QWebServerSocket, I get
    these warnings on incoming connections:

       QObject: Cannot create children for a parent that is in a different
         thread.
         (Parent is QNativeSocketEngine(0x1b12ab0),
           parent's thread is QThread( GUI_thread ),
           current thread is QThread( communication_thread )

    In addition, the disconnect event never comes through, probably as a
    consequence of the warning.

    Question: Is it possible to use QWebSocketServer in a thread other
    than the GUI thread? How?

[...]

Best Regards / Mit freundlichen Grüßen
Rainer Wiesenfarth

--
Software Engineer | Trimble Imaging Division
Rotebühlstraße 81 | 70178 Stuttgart | Germany
Office +49 711 22881 0 | Fax +49 711 22881 11
http://www.trimble.com/imaging/ | http://www.inpho.de/

Trimble Germany GmbH, Am Prime Parc 11, 65479 Raunheim
Eingetragen beim Amtsgericht Darmstadt unter HRB 83893,
Geschäftsführer: Dr. Frank Heimberg, Hans-Jürgen Gebauer

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to