Skip to content
Permalink
Browse files

fix Chained filters crash QGIS when switching between ui tabs

fix #17736
  • Loading branch information
3nids committed Jan 19, 2018
1 parent 123470b commit a0d0648da5f8e0d10c0f4c1edc64891e34455460
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
@@ -41,6 +41,7 @@
#include "qgsfeatureiterator.h"
#include "qgsfeaturelistcombobox.h"


QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget *parent )
: QWidget( parent )
{
@@ -441,7 +442,7 @@ void QgsRelationReferenceWidget::init()

if ( !mFilterFields.isEmpty() )
{
Q_FOREACH ( const QString &fieldName, mFilterFields )
for ( const QString &fieldName : mFilterFields )
{
int idx = mReferencedLayer->fields().lookupField( fieldName );

@@ -479,7 +480,8 @@ void QgsRelationReferenceWidget::init()
QgsFeatureIterator fit = mReferencedLayer->getFeatures();
while ( fit.nextFeature( ft ) )
{
for ( int i = 0; i < mFilterComboBoxes.count() - 1; ++i )
const int count = std::min( mFilterComboBoxes.count(), mFilterFields.count() );
for ( int i = 0; i < count - 1; i++ )
{
QVariant cv = ft.attribute( mFilterFields.at( i ) );
QVariant nv = ft.attribute( mFilterFields.at( i + 1 ) );

0 comments on commit a0d0648

Please sign in to comment.
You can’t perform that action at this time.