Skip to content

Commit

Permalink
Additional guard against endless update loop
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Oct 19, 2022
1 parent e881622 commit db90b04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/core/attributeformmodelbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ void AttributeFormModelBase::flatten( QgsAttributeEditorContainer *container, QS
}
}

void AttributeFormModelBase::updateDefaultValues( int fieldIndex )
void AttributeFormModelBase::updateDefaultValues( int fieldIndex, QVector<int> updatedFields )
{
const QgsFields fields = mFeatureModel->feature().fields();
if ( fieldIndex < 0 || fieldIndex >= fields.size() )
Expand Down Expand Up @@ -511,7 +511,11 @@ void AttributeFormModelBase::updateDefaultValues( int fieldIndex )
if ( success && updatedValue != previousValue )
{
item->setData( defaultValue, AttributeFormModel::AttributeValue );
updateDefaultValues( fidx );
if ( !updatedFields.contains( fidx ) )
{
updatedFields.append( fidx );
updateDefaultValues( fidx, updatedFields );
}
updateVisibilityAndConstraints( fidx );
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/attributeformmodelbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class AttributeFormModelBase : public QStandardItemModel

void flatten( QgsAttributeEditorContainer *container, QStandardItem *parent, const QString &parentVisibilityExpressions, QVector<QStandardItem *> &items, int currentTabIndex = 0, const QColor &color = QColor() );

void updateDefaultValues( int fieldIndex = -1 );
void updateDefaultValues( int fieldIndex = -1, QVector<int> updatedFields = QVector<int>() );

void updateVisibilityAndConstraints( int fieldIndex = -1 );

Expand Down

1 comment on commit db90b04

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Ta-daaa, freshly created APKs are available:

Other architectures: arm-android, x64-android, x86

Please sign in to comment.