Skip to content
  • Peter Kümmel's avatar
    Set parent of internal socket objects · e8335d48
    Peter Kümmel authored
    After moving the websocket into another thread
    current code doesn't work because then the QTcpSocket/QSslSocket
    objects reside in a different thread, for instance:
    "QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread"
    
    QObject::moveToThread(QThread*) also moves QObjects's children,
    therefore their internal socket objects need to be children of QWebSocket.
    
    QWebSocket has ownership of the internal socket, and the
    smart pointer is not needed any more.
    
    Change of cleanup code to prevent crashes with clang/msvc builds:
    QWebSocketPrivate is a scoped member of QObject (not QWebSocket)
    and is destroyed after QObject destructor body was executed,
    and so  m_pSocket&co had already been destroyed (being children)
    when the destructor of QWebSocketPrivate is called via the
    scoped pointer.
    
    Analogous to 64927e04
    
    
    
    Change-Id: I1ade6cda3fa793c30332cc5e103025e2dda3c78c
    Reviewed-by: default avatarLuca Niccoli <lultimouomo@gmail.com>
    Reviewed-by: default avatarAlex Blasche <alexander.blasche@theqtcompany.com>
    e8335d48