Skip to content

Commit faf4b7f

Browse files
committed
fix crash in identify menu when closing a project with map layer actions
1 parent 5645a18 commit faf4b7f

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/gui/qgsidentifymenu.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,23 @@ QList<QgsMapToolIdentify::IdentifyResult> QgsIdentifyMenu::exec( const QList<Qgs
136136
bool externalAction;
137137
returnResults = results( selectedAction, externalAction );
138138

139+
// delete actions
140+
clear();
141+
// also remove the QgsActionMenu
142+
QList<QgsActionMenu*> actionMenus = findChildren<QgsActionMenu*>();
143+
Q_FOREACH ( QgsActionMenu* actionMenu, actionMenus )
144+
{
145+
delete actionMenu;
146+
}
147+
139148
if ( externalAction && !mResultsIfExternalAction )
149+
{
140150
return QList<QgsMapToolIdentify::IdentifyResult>();
141-
142-
return returnResults;
151+
}
152+
else
153+
{
154+
return returnResults;
155+
}
143156
}
144157

145158
void QgsIdentifyMenu::addRasterLayer( QgsMapLayer* layer )
@@ -316,7 +329,7 @@ void QgsIdentifyMenu::addVectorLayer( QgsVectorLayer* layer, const QList<QgsMapT
316329
QList<QgsMapLayerAction*> customFeatureActions = mCustomActionRegistry.mapLayerActions( layer, QgsMapLayerAction::SingleFeature );
317330
if ( mShowFeatureActions )
318331
{
319-
featureActionMenu = new QgsActionMenu( layer, &( result.mFeature ), this );
332+
featureActionMenu = new QgsActionMenu( layer, &( result.mFeature ), layerMenu );
320333
}
321334

322335
// feature title

0 commit comments

Comments
 (0)