forked from qt-creator/qt-creator
QmlDebug: Use versioned packets for engine control client
The service also uses versioned packets and not doing this might create subtle bugs. Change-Id: I54dfbe4f8e3d3a71daf2fe503a609c52c6a158bb Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlenginecontrolclient.h"
|
#include "qmlenginecontrolclient.h"
|
||||||
|
#include "qpacketprotocol.h"
|
||||||
#include "utils/qtcassert.h"
|
#include "utils/qtcassert.h"
|
||||||
|
|
||||||
namespace QmlDebug {
|
namespace QmlDebug {
|
||||||
@@ -66,9 +67,9 @@ void QmlEngineControlClient::releaseEngine(int engineId)
|
|||||||
|
|
||||||
void QmlEngineControlClient::messageReceived(const QByteArray &data)
|
void QmlEngineControlClient::messageReceived(const QByteArray &data)
|
||||||
{
|
{
|
||||||
QDataStream stream(data);
|
QPacket stream(dataStreamVersion(), data);
|
||||||
int message;
|
qint32 message;
|
||||||
int id;
|
qint32 id;
|
||||||
QString name;
|
QString name;
|
||||||
|
|
||||||
stream >> message >> id;
|
stream >> message >> id;
|
||||||
@@ -104,10 +105,9 @@ void QmlEngineControlClient::messageReceived(const QByteArray &data)
|
|||||||
|
|
||||||
void QmlEngineControlClient::sendCommand(QmlEngineControlClient::CommandType command, int engineId)
|
void QmlEngineControlClient::sendCommand(QmlEngineControlClient::CommandType command, int engineId)
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QPacket stream(dataStreamVersion());
|
||||||
QDataStream stream(&data, QIODevice::WriteOnly);
|
stream << static_cast<qint32>(command) << engineId;
|
||||||
stream << int(command) << engineId;
|
QmlDebugClient::sendMessage(stream.data());
|
||||||
QmlDebugClient::sendMessage(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user