From 1d483cd3528dd3cc845076451645e79a174e5eda Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 11 Nov 2014 13:46:16 +0100 Subject: [PATCH] QmlProfiler: Fix location for QtQuick1 events before using them If this is not done multiple event types with empty locations are regarded as equal which leads to confusion later. Also, it's not a good idea to change the "location" member for already inserted event types as that prevents us from looking them up in the eventTypeIds map. Finally, preprocessing the filename and stripping certain parts from the URL prevents a proper lookup later on, so this is removed. Change-Id: Idbe87e0b16444291bb13ff604ae65e1d7e74c3a5 Task-number: QTCREATORBUG-13382 Reviewed-by: Kai Koehne --- .../qmlprofiler/qmlprofilerdatamodel.cpp | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp index b0ff9638596..84b759d99af 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp @@ -53,20 +53,6 @@ private: Q_DECLARE_PUBLIC(QmlProfilerDataModel) }; -QString getInitialDetails(const QmlProfilerDataModel::QmlEventTypeData &event); - -QmlDebug::QmlEventLocation getLocation(const QmlProfilerDataModel::QmlEventTypeData &event) -{ - QmlDebug::QmlEventLocation eventLocation = event.location; - if ((event.rangeType == QmlDebug::Creating || event.rangeType == QmlDebug::Compiling) - && eventLocation.filename.isEmpty()) { - eventLocation.filename = getInitialDetails(event); - eventLocation.line = 1; - eventLocation.column = 1; - } - return eventLocation; -} - QString getDisplayName(const QmlProfilerDataModel::QmlEventTypeData &event) { if (event.location.filename.isEmpty()) { @@ -214,7 +200,6 @@ void QmlProfilerDataModel::complete() int n = d->eventTypes.count(); for (int i = 0; i < n; i++) { QmlEventTypeData *event = &d->eventTypes[i]; - event->location = getLocation(*event); event->displayName = getDisplayName(*event); event->data = getInitialDetails(*event); @@ -253,6 +238,14 @@ void QmlProfilerDataModel::addQmlEvent(QmlDebug::Message message, QmlDebug::Rang QString displayName; QmlEventTypeData typeData = {displayName, location, message, rangeType, detailType, data}; + + // Special case for QtQuick 1 Compiling and Creating events: filename is in the "data" field. + if ((rangeType == QmlDebug::Compiling || rangeType == QmlDebug::Creating) && + location.filename.isEmpty()) { + typeData.location.filename = data; + typeData.location.line = typeData.location.column = 1; + } + QmlEventData eventData = {-1, startTime, duration, ndata1, ndata2, ndata3, ndata4, ndata5}; QHash::Iterator it = d->eventTypeIds.find(typeData);