forked from qt-creator/qt-creator
EffectMaker: Fix crash after opening saved effect when nodes exist
Clear and removeAllNodes functions were consolidated into one clear() function, which now properly resets the entire model. This makes UI properly synced to actual model state when composition is opened, so the phantom nodes will no longer appear. Fixes: QDS-11347 Change-Id: I204760cca6af669daa43a18bfb199dfbf14b73cb Reviewed-by: Amr Elsayed <amr.elsayed@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -139,7 +139,7 @@ void EffectMakerModel::removeNode(int idx)
|
||||
bakeShaders();
|
||||
}
|
||||
|
||||
void EffectMakerModel::removeAllNodes()
|
||||
void EffectMakerModel::clear()
|
||||
{
|
||||
beginResetModel();
|
||||
qDeleteAll(m_nodes);
|
||||
@@ -180,24 +180,6 @@ const QString &EffectMakerModel::qmlComponentString() const
|
||||
return m_qmlComponentString;
|
||||
}
|
||||
|
||||
void EffectMakerModel::clear()
|
||||
{
|
||||
if (m_nodes.isEmpty())
|
||||
return;
|
||||
|
||||
beginRemoveRows({}, 0, m_nodes.count());
|
||||
|
||||
for (CompositionNode *node : std::as_const(m_nodes))
|
||||
delete node;
|
||||
|
||||
m_nodes.clear();
|
||||
|
||||
endRemoveRows();
|
||||
|
||||
setIsEmpty(true);
|
||||
bakeShaders();
|
||||
}
|
||||
|
||||
const QList<Uniform *> EffectMakerModel::allUniforms()
|
||||
{
|
||||
QList<Uniform *> uniforms = {};
|
||||
|
||||
Reference in New Issue
Block a user