Commit 8f7bd196 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: be more resilient against missing models in render passes



Change-Id: Ib5c0ec44bac213f544dfce533299bee03213b374
Reviewed-by: default avatarKai Koehne <kai.koehne@theqtcompany.com>
parent 4b5d38c8
...@@ -159,6 +159,9 @@ Timeline::TimelineRenderPass::State *QmlProfilerBindingLoopsRenderPass::update( ...@@ -159,6 +159,9 @@ Timeline::TimelineRenderPass::State *QmlProfilerBindingLoopsRenderPass::update(
const QmlProfilerRangeModel *model = qobject_cast<const QmlProfilerRangeModel *>( const QmlProfilerRangeModel *model = qobject_cast<const QmlProfilerRangeModel *>(
renderer->model()); renderer->model());
if (!model || indexFrom < 0 || indexTo > model->count())
return oldState;
BindingLoopsRenderPassState *state; BindingLoopsRenderPassState *state;
if (oldState == 0) { if (oldState == 0) {
state = new BindingLoopsRenderPassState; state = new BindingLoopsRenderPassState;
...@@ -170,12 +173,6 @@ Timeline::TimelineRenderPass::State *QmlProfilerBindingLoopsRenderPass::update( ...@@ -170,12 +173,6 @@ Timeline::TimelineRenderPass::State *QmlProfilerBindingLoopsRenderPass::update(
state = static_cast<BindingLoopsRenderPassState *>(oldState); state = static_cast<BindingLoopsRenderPassState *>(oldState);
} }
if (!model)
return state;
if (indexFrom < 0 || indexTo > model->count())
return state;
if (state->indexFrom < state->indexTo) { if (state->indexFrom < state->indexTo) {
if (indexFrom < state->indexFrom) { if (indexFrom < state->indexFrom) {
for (int i = indexFrom; i < state->indexFrom; for (int i = indexFrom; i < state->indexFrom;
......
...@@ -280,6 +280,10 @@ TimelineRenderPass::State *TimelineItemsRenderPass::update(const TimelineAbstrac ...@@ -280,6 +280,10 @@ TimelineRenderPass::State *TimelineItemsRenderPass::update(const TimelineAbstrac
qreal spacing) const qreal spacing) const
{ {
Q_UNUSED(stateChanged); Q_UNUSED(stateChanged);
const TimelineModel *model = renderer->model();
if (!model || indexFrom < 0 || indexTo > model->count())
return oldState;
QColor selectionColor = (renderer->selectionLocked() ? QColor(96,0,255) : QColor selectionColor = (renderer->selectionLocked() ? QColor(96,0,255) :
QColor(Qt::blue)).lighter(130); QColor(Qt::blue)).lighter(130);
...@@ -289,7 +293,7 @@ TimelineRenderPass::State *TimelineItemsRenderPass::update(const TimelineAbstrac ...@@ -289,7 +293,7 @@ TimelineRenderPass::State *TimelineItemsRenderPass::update(const TimelineAbstrac
else else
state = static_cast<TimelineItemsRenderPassState *>(oldState); state = static_cast<TimelineItemsRenderPassState *>(oldState);
const TimelineModel *model = renderer->model();
float selectedItem = renderer->selectedItem() == -1 ? -1 : float selectedItem = renderer->selectedItem() == -1 ? -1 :
model->selectionId(renderer->selectedItem()); model->selectionId(renderer->selectedItem());
...@@ -306,9 +310,6 @@ TimelineRenderPass::State *TimelineItemsRenderPass::update(const TimelineAbstrac ...@@ -306,9 +310,6 @@ TimelineRenderPass::State *TimelineItemsRenderPass::update(const TimelineAbstrac
state->m_collapsedRows << new QSGNode; state->m_collapsedRows << new QSGNode;
} }
if (indexFrom < 0 || indexTo > model->count())
return state;
if (state->indexFrom < state->indexTo) { if (state->indexFrom < state->indexTo) {
if (indexFrom < state->indexFrom) { if (indexFrom < state->indexFrom) {
for (int i = indexFrom; i < state->indexFrom; for (int i = indexFrom; i < state->indexFrom;
......
...@@ -109,6 +109,9 @@ TimelineRenderPass::State *TimelineNotesRenderPass::update(const TimelineAbstrac ...@@ -109,6 +109,9 @@ TimelineRenderPass::State *TimelineNotesRenderPass::update(const TimelineAbstrac
const TimelineNotesModel *notes = renderer->notes(); const TimelineNotesModel *notes = renderer->notes();
const TimelineModel *model = renderer->model(); const TimelineModel *model = renderer->model();
if (!model || !notes)
return oldState;
TimelineNotesRenderPassState *state; TimelineNotesRenderPassState *state;
if (oldState == 0) { if (oldState == 0) {
state = new TimelineNotesRenderPassState(model->expandedRowCount()); state = new TimelineNotesRenderPassState(model->expandedRowCount());
......
...@@ -61,6 +61,10 @@ TimelineRenderPass::State *TimelineSelectionRenderPass::update( ...@@ -61,6 +61,10 @@ TimelineRenderPass::State *TimelineSelectionRenderPass::update(
{ {
Q_UNUSED(stateChanged); Q_UNUSED(stateChanged);
const TimelineModel *model = renderer->model();
if (!model)
return oldState;
TimelineSelectionRenderPassState *state; TimelineSelectionRenderPassState *state;
if (oldState == 0) { if (oldState == 0) {
...@@ -71,7 +75,6 @@ TimelineRenderPass::State *TimelineSelectionRenderPass::update( ...@@ -71,7 +75,6 @@ TimelineRenderPass::State *TimelineSelectionRenderPass::update(
state = static_cast<TimelineSelectionRenderPassState *>(oldState); state = static_cast<TimelineSelectionRenderPassState *>(oldState);
} }
const TimelineModel *model = renderer->model();
QSGSimpleRectNode *selectionNode = static_cast<QSGSimpleRectNode *>(model->expanded() ? QSGSimpleRectNode *selectionNode = static_cast<QSGSimpleRectNode *>(model->expanded() ?
state->m_expandedOverlay : state->m_expandedOverlay :
state->m_collapsedOverlay); state->m_collapsedOverlay);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment