QmlProfiler: Don't add junk to the end of strings from QmlEvents

The UTF-8 data stored in the event is not necessarily null-terminated.

Change-Id: Id5d4f0b50f8c7c70aa6576121905072984f1c342
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2016-06-06 15:34:32 +02:00
parent 6de290a188
commit 0023c87098

View File

@@ -159,9 +159,9 @@ struct QmlEvent {
{ {
switch (m_dataType) { switch (m_dataType) {
case External8Bit: case External8Bit:
return QString::fromUtf8(static_cast<const char *>(m_data.external)); return QString::fromUtf8(static_cast<const char *>(m_data.external), m_dataLength);
case Inline8Bit: case Inline8Bit:
return QString::fromUtf8(m_data.internalChar); return QString::fromUtf8(m_data.internalChar, m_dataLength);
default: default:
Q_UNREACHABLE(); Q_UNREACHABLE();
return QString(); return QString();