Skip to content

Commit

Permalink
fix crash in identify menu when closing a project with map layer actions
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Sep 18, 2014
1 parent 5645a18 commit faf4b7f
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/gui/qgsidentifymenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,23 @@ QList<QgsMapToolIdentify::IdentifyResult> QgsIdentifyMenu::exec( const QList<Qgs
bool externalAction;
returnResults = results( selectedAction, externalAction );

// delete actions
clear();
// also remove the QgsActionMenu
QList<QgsActionMenu*> actionMenus = findChildren<QgsActionMenu*>();
Q_FOREACH ( QgsActionMenu* actionMenu, actionMenus )

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Sep 18, 2014

Member

Small side-note, there is a nice shortcut for this:
qDeleteAll( actionMenus );

This comment has been minimized.

Copy link
@3nids

3nids Sep 18, 2014

Author Member

thanks!

{
delete actionMenu;
}

if ( externalAction && !mResultsIfExternalAction )
{
return QList<QgsMapToolIdentify::IdentifyResult>();

return returnResults;
}
else
{
return returnResults;
}
}

void QgsIdentifyMenu::addRasterLayer( QgsMapLayer* layer )
Expand Down Expand Up @@ -316,7 +329,7 @@ void QgsIdentifyMenu::addVectorLayer( QgsVectorLayer* layer, const QList<QgsMapT
QList<QgsMapLayerAction*> customFeatureActions = mCustomActionRegistry.mapLayerActions( layer, QgsMapLayerAction::SingleFeature );
if ( mShowFeatureActions )
{
featureActionMenu = new QgsActionMenu( layer, &( result.mFeature ), this );
featureActionMenu = new QgsActionMenu( layer, &( result.mFeature ), layerMenu );
}

// feature title
Expand Down

0 comments on commit faf4b7f

Please sign in to comment.