Skip to content

Commit

Permalink
Fix crash when editing feature after opening a form with relation ref…
Browse files Browse the repository at this point in the history
…erence widget

Also fixes a leak/performance issue - the attribute table model
for the relation reference widget is not parented to the widget,
so it is never cleaned up when the widget is deleted.
  • Loading branch information
nyalldawson authored and m-kuhn committed Aug 7, 2017
1 parent 5701b67 commit f976e8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsrelationreferencewidget.cpp
Expand Up @@ -521,7 +521,7 @@ void QgsRelationReferenceWidget::init()
attributes << mReferencedLayer->fieldNameIndex( attr );

layerCache->setCacheSubsetOfAttributes( attributes );
mMasterModel = new QgsAttributeTableModel( layerCache );
mMasterModel = new QgsAttributeTableModel( layerCache, this );
mMasterModel->setRequest( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ).setSubsetOfAttributes( requestedAttrs.toList(), mReferencedLayer->fields() ) );
mFilterModel = new QgsAttributeTableFilterModel( mCanvas, mMasterModel, mMasterModel );
mFeatureListModel = new QgsFeatureListModel( mFilterModel, this );
Expand Down

2 comments on commit f976e8b

@andreasneumann
Copy link
Member

Choose a reason for hiding this comment

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

@nyalldawson @m-kuhn is this also relevant on master?
same question also for commit c6d8827

@nyalldawson
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes & yes - i'll forward port.

Please sign in to comment.