Skip to content


Browse files Browse the repository at this point in the history
Fix crash when removing drag and drop form elements
If both a container and a item within that container are selected
and then the "remove" button is pressed, QGIS will crash

Avoid the crash by removing items one-by-one, so that we don't try
to delete a child item which was already deleted by its parent.
  • Loading branch information
nyalldawson authored and github-actions[bot] committed May 4, 2023
1 parent 0eb8e05 commit c1d4b18
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/gui/vector/qgsattributesformproperties.cpp
Expand Up @@ -737,7 +737,17 @@ void QgsAttributesFormProperties::addTabOrGroupButton()

void QgsAttributesFormProperties::removeTabOrGroupButton()
qDeleteAll( mFormLayoutTree->selectedItems() );
// deleting an item may delete any number of nested child items -- so we delete
// them one at a time and then see if there's any selection left
while ( true )
const QList<QTreeWidgetItem *> items = mFormLayoutTree->selectedItems();
if ( items.empty() )

delete 0 );


Expand Down

0 comments on commit c1d4b18

Please sign in to comment.