Skip to content

Commit

Permalink
fix invalid list index in identify results causing wrong result or se…
Browse files Browse the repository at this point in the history
…gfault accessing actions from context menu
  • Loading branch information
brushtyler committed Dec 31, 2011
1 parent 100d702 commit ffa2cfd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/qgsidentifyresults.cpp
Expand Up @@ -460,6 +460,8 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
{
mActionPopup->addSeparator();

int featIdx = featItem->data( 0, Qt::UserRole + 1 ).toInt();

// The assumption is made that an instance of QgsIdentifyResults is
// created for each new Identify Results dialog box, and that the
// contents of the popup menu doesn't change during the time that
Expand All @@ -471,7 +473,7 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
if ( !action.runable() )
continue;

QgsFeatureAction *a = new QgsFeatureAction( action.name(), mFeatures[ idx ], vlayer, i, idx, this );
QgsFeatureAction *a = new QgsFeatureAction( action.name(), mFeatures[ featIdx ], vlayer, i, idx, this );
mActionPopup->addAction( QgisApp::getThemeIcon( "/mAction.png" ), action.name(), a, SLOT( execute() ) );
}
}
Expand Down

0 comments on commit ffa2cfd

Please sign in to comment.