From ae1f591fc67b05768fb4f4a587c05d25707ac630 Mon Sep 17 00:00:00 2001 From: Jere Tuliniemi Date: Wed, 13 Feb 2019 14:15:17 +0200 Subject: Fix crash when changing basic material color Task-number: QT3DS-3005 Change-Id: I0eabbc1177cb8f94cd747817e7c6aebeb30871ff Reviewed-by: Miikka Heikkinen --- src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp index 1232939c..e7dbfe7f 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp @@ -1000,10 +1000,8 @@ bool InspectorControlModel::isTreeRebuildRequired(CInspectableBase* inspectBase) long theCount = m_inspectableBase->GetGroupCount(); auto refMaterial = getReferenceMaterial(inspectBase); - if (refMaterial != m_refMaterial) { - m_refMaterial = refMaterial; + if (refMaterial != m_refMaterial) return true; - } long refMaterialGroupCount = 0; if (refMaterial.Valid()) refMaterialGroupCount = 1; // Only the last group of the refMaterial is used @@ -1196,6 +1194,8 @@ void InspectorControlModel::rebuildTree() // Clean the old objects after reset is done so that qml will not freak out about null pointers for (int i = 0; i < deleteVector.count(); ++i) deleteVector[i]->deleteLater(); + + m_refMaterial = getReferenceMaterial(m_inspectableBase); } int InspectorControlModel::rowCount(const QModelIndex &parent) const -- cgit v1.2.3