Skip to content

Commit 6654e20

Browse files
brushtylerjef-n
authored andcommitted
backport: fix invalid list index in identify results causing wrong result or segfault accessing actions from context menu
1 parent 27b9a9d commit 6654e20

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/app/qgsidentifyresults.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
457457
{
458458
mActionPopup->addSeparator();
459459

460+
int featIdx = featItem->data( 0, Qt::UserRole + 1 ).toInt();
461+
460462
// The assumption is made that an instance of QgsIdentifyResults is
461463
// created for each new Identify Results dialog box, and that the
462464
// contents of the popup menu doesn't change during the time that
@@ -468,8 +470,7 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
468470
if ( !action.runable() )
469471
continue;
470472

471-
int idx = featItem->data( 0, Qt::UserRole + 1 ).toInt();
472-
QgsFeatureAction *a = new QgsFeatureAction( action.name(), mFeatures[ idx ], vlayer, i, idx, this );
473+
QgsFeatureAction *a = new QgsFeatureAction( action.name(), mFeatures[ featIdx ], vlayer, i, idx, this );
473474
mActionPopup->addAction( QgisApp::getThemeIcon( "/mAction.png" ), action.name(), a, SLOT( execute() ) );
474475
}
475476
}

0 commit comments

Comments
 (0)