Skip to content
Permalink
Browse files

Merge pull request #6040 from signedav/crashfix

mapLayerActions as members - avoiding crash on closing QGIS

Fix #17839
  • Loading branch information
m-kuhn committed Jan 12, 2018
2 parents d6ef2b6 + ff96e1d commit 074db04f27d31aaea4c4e96f9751e9aac98bcd18
Showing with 13 additions and 10 deletions.
  1. +10 −10 src/app/qgisapp.cpp
  2. +3 −0 src/app/qgisapp.h
@@ -7451,23 +7451,23 @@ void QgisApp::setupLayoutManagerConnections()

void QgisApp::setupDuplicateFeaturesAction()
{
QgsMapLayerAction *action = new QgsMapLayerAction( QString( tr( "Duplicate feature" ) ),
this, QgsMapLayerAction::AllActions,
QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateFeature.svg" ) ) );
mDuplicateFeatureAction.reset( new QgsMapLayerAction( tr( "Duplicate feature" ),
nullptr, QgsMapLayerAction::SingleFeature,
QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateFeature.svg" ) ) ) );

QgsGui::mapLayerActionRegistry()->addMapLayerAction( action );
connect( action, &QgsMapLayerAction::triggeredForFeature, this, [this]( QgsMapLayer * layer, const QgsFeature & feat )
QgsGui::mapLayerActionRegistry()->addMapLayerAction( mDuplicateFeatureAction.get() );
connect( mDuplicateFeatureAction.get(), &QgsMapLayerAction::triggeredForFeature, this, [this]( QgsMapLayer * layer, const QgsFeature & feat )
{
duplicateFeatures( layer, feat );
}
);

action = new QgsMapLayerAction( QString( tr( "Duplicate feature and digitize" ) ),
this, QgsMapLayerAction::AllActions,
QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateFeatureDigitized.svg" ) ) );
mDuplicateFeatureDigitizeAction.reset( new QgsMapLayerAction( tr( "Duplicate feature and digitize" ),
nullptr, QgsMapLayerAction::SingleFeature,
QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateFeatureDigitized.svg" ) ) ) );

QgsGui::mapLayerActionRegistry()->addMapLayerAction( action );
connect( action, &QgsMapLayerAction::triggeredForFeature, this, [this]( QgsMapLayer * layer, const QgsFeature & feat )
QgsGui::mapLayerActionRegistry()->addMapLayerAction( mDuplicateFeatureDigitizeAction.get() );
connect( mDuplicateFeatureDigitizeAction.get(), &QgsMapLayerAction::triggeredForFeature, this, [this]( QgsMapLayer * layer, const QgsFeature & feat )
{
duplicateFeatureDigitized( layer, feat );
}
@@ -2146,6 +2146,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

QHash< QgsPrintLayout *, QgsMapLayerAction * > mAtlasFeatureActions;

std::unique_ptr<QgsMapLayerAction> mDuplicateFeatureAction;
std::unique_ptr<QgsMapLayerAction> mDuplicateFeatureDigitizeAction;

int mProjOpen = 0;

bool gestureEvent( QGestureEvent *event );

0 comments on commit 074db04

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