diff --git a/src/libs/qmldebug/qmldebugclient.cpp b/src/libs/qmldebug/qmldebugclient.cpp index 1a7f8656f83..45816918a87 100644 --- a/src/libs/qmldebug/qmldebugclient.cpp +++ b/src/libs/qmldebug/qmldebugclient.cpp @@ -329,11 +329,15 @@ QString QmlDebugClient::name() const return d->name; } -float QmlDebugClient::serviceVersion() const +int QmlDebugClient::remoteVersion() const { Q_D(const QmlDebugClient); + // The version is internally saved as float for compatibility reasons. Exposing that to clients + // is a bad idea because floats cannot be properly compared. IEEE 754 floats represent integers + // exactly up to about 2^24, so the cast shouldn't be a problem for any realistic version + // numbers. if (d->connection && d->connection->d->serverPlugins.contains(d->name)) - return d->connection->d->serverPlugins.value(d->name); + return static_cast(d->connection->d->serverPlugins.value(d->name)); return -1; } diff --git a/src/libs/qmldebug/qmldebugclient.h b/src/libs/qmldebug/qmldebugclient.h index c865f410a54..13fe17736ba 100644 --- a/src/libs/qmldebug/qmldebugclient.h +++ b/src/libs/qmldebug/qmldebugclient.h @@ -78,7 +78,7 @@ public: ~QmlDebugClient(); QString name() const; - float serviceVersion() const; + int remoteVersion() const; State state() const; virtual void sendMessage(const QByteArray &); diff --git a/src/plugins/debugger/qml/qmladapter.cpp b/src/plugins/debugger/qml/qmladapter.cpp index eab409a682a..caad47fb6d2 100644 --- a/src/plugins/debugger/qml/qmladapter.cpp +++ b/src/plugins/debugger/qml/qmladapter.cpp @@ -119,7 +119,7 @@ void QmlAdapter::clientStateChanged(QmlDebugClient::State state) float version = 0; if (QmlDebugClient *client = qobject_cast(sender())) { serviceName = client->name(); - version = client->serviceVersion(); + version = client->remoteVersion(); } logServiceStateChange(serviceName, version, state); diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.cpp b/src/plugins/debugger/qml/qmlinspectoradapter.cpp index 11a7c5513e0..b2cb9ccee21 100644 --- a/src/plugins/debugger/qml/qmlinspectoradapter.cpp +++ b/src/plugins/debugger/qml/qmlinspectoradapter.cpp @@ -190,7 +190,7 @@ void QmlInspectorAdapter::clientStateChanged(QmlDebugClient::State state) float version = 0; if (QmlDebugClient *client = qobject_cast(sender())) { serviceName = client->name(); - version = client->serviceVersion(); + version = client->remoteVersion(); } m_debugAdapter->logServiceStateChange(serviceName, version, state);