QmlDebug: Don't use QmlDebugConnection unconditionally

It might be null. We wrap the retrieval of the data stream version in
QmlDebugClient and return the minimum if connection is null. The extra
copy of the connection QmlEngine is dropped as QmlDebugClient already
has one and we don't want to hit a dangling pointer.

Change-Id: Ida8c45d357d46b4942eea99b77065d3c51c7edb9
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2017-09-07 15:17:15 +02:00
parent 239ed56f4b
commit 1634987cae
7 changed files with 56 additions and 45 deletions

View File

@@ -166,7 +166,7 @@ void QmlProfilerTraceClientPrivate::processCurrentEvent()
void QmlProfilerTraceClientPrivate::sendRecordingStatus(int engineId)
{
QmlDebug::QPacket stream(q->connection()->currentDataStreamVersion());
QmlDebug::QPacket stream(q->dataStreamVersion());
stream << recording << engineId; // engineId -1 is OK. It means "all of them"
if (recording) {
stream << requestedFeatures << flushInterval;
@@ -282,7 +282,7 @@ void QmlProfilerTraceClient::stateChanged(State status)
void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
{
QmlDebug::QPacket stream(connection()->currentDataStreamVersion(), data);
QmlDebug::QPacket stream(dataStreamVersion(), data);
stream >> d->currentEvent;