Skip to content

Commit

Permalink
Fix crash when applying vector properties dialog
Browse files Browse the repository at this point in the history
Applyling the field configuration was setting the field properties for
the layer, which was triggering a connection to rebuild the dialog
properties while we were still mid-way through applying the changes.
  • Loading branch information
nyalldawson committed Feb 20, 2024
1 parent a95aa85 commit 086d5cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gui/vector/qgsattributesformproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ QgsAttributesFormProperties::QgsAttributesFormProperties( QgsVectorLayer *layer,
connect( pbnSelectEditForm, &QToolButton::clicked, this, &QgsAttributesFormProperties::pbnSelectEditForm_clicked );
connect( mTbInitCode, &QPushButton::clicked, this, &QgsAttributesFormProperties::mTbInitCode_clicked );

connect( mLayer, &QgsVectorLayer::updatedFields, this, &QgsAttributesFormProperties::updatedFields );
connect( mLayer, &QgsVectorLayer::updatedFields, this, [this]
{
if ( !mBlockUpdates )
updatedFields();
} );
}

void QgsAttributesFormProperties::init()
Expand Down Expand Up @@ -948,6 +952,7 @@ void QgsAttributesFormProperties::store()

void QgsAttributesFormProperties::apply()
{
mBlockUpdates++;
storeAttributeWidgetEdit();
storeAttributeContainerEdit();
storeAttributeTypeDialog();
Expand Down Expand Up @@ -1058,6 +1063,7 @@ void QgsAttributesFormProperties::apply()
}

mLayer->setEditFormConfig( editFormConfig );
mBlockUpdates--;
}


Expand Down
1 change: 1 addition & 0 deletions src/gui/vector/qgsattributesformproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ class GUI_EXPORT QgsAttributesFormProperties : public QWidget, public QgsExpress
QString mInitFunction;
QString mInitFilePath;
QString mInitCode;
int mBlockUpdates = 0;

};

Expand Down

0 comments on commit 086d5cf

Please sign in to comment.