summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2017-05-03 13:19:12 (GMT)
committerEdward Welbourne <edward.welbourne@qt.io>2017-05-04 12:55:26 (GMT)
commit9970187acb7221f62ec001128026d202391699c0 (patch)
tree0ce8febad52eae2c69b968f9d3cf3bb7650139be
parentcec66b8969215d7355aa61655e68893f7dad5595 (diff)
downloadqtwebsockets-9970187acb7221f62ec001128026d202391699c0.tar.gz
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 <Jesus.Fernandez@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--src/imports/qmlwebsockets/qqmlwebsocket.cpp4
1 files changed, 1 insertions, 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