From 9970187acb7221f62ec001128026d202391699c0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 3 May 2017 15:19:12 +0200 Subject: QQmlWebSocket::setUrl(): let open() decided what to actually do After emitting urlChanged(), setUrl() did a manual open(url) if it had a web-socket to do it on, omitting various checks that open() imposes on actually calling open(url); as a result, it left the web socket in an inconsistent state if it wasn't yet active. This meant that setting active could trigger a second open() while the web-socket was already open(), which upset it. Replaced the hand-rolled call to open(url) with a call to open() so as to be consistent and avoid such problems. Task-number: QTBUG-58278 Change-Id: Iee84f2b0d973e7fd288a14018039a665658c0040 Reviewed-by: Jesus Fernandez Reviewed-by: Timur Pocheptsov --- src/imports/qmlwebsockets/qqmlwebsocket.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/imports/qmlwebsockets/qqmlwebsocket.cpp b/src/imports/qmlwebsockets/qqmlwebsocket.cpp index 35f6259..37a2fad 100644 --- a/src/imports/qmlwebsockets/qqmlwebsocket.cpp +++ b/src/imports/qmlwebsockets/qqmlwebsocket.cpp @@ -181,9 +181,7 @@ void QQmlWebSocket::setUrl(const QUrl &url) } m_url = url; Q_EMIT urlChanged(); - if (m_webSocket) { - m_webSocket->open(m_url); - } + open(); } QQmlWebSocket::Status QQmlWebSocket::status() const -- cgit v1.2.1