diff --git a/shell/runcontroller.h b/shell/runcontroller.h --- a/shell/runcontroller.h +++ b/shell/runcontroller.h @@ -140,6 +140,7 @@ private: void setupActions(); void checkState(); + void removeLaunchConfigurationInternal( LaunchConfiguration* l ); Q_PRIVATE_SLOT(d, void configureLaunches()) Q_PRIVATE_SLOT(d, void launchAs(int)) diff --git a/shell/runcontroller.cpp b/shell/runcontroller.cpp --- a/shell/runcontroller.cpp +++ b/shell/runcontroller.cpp @@ -767,8 +767,7 @@ { if( l->type() == type ) { - d->launchConfigurations.removeAll( l ); - delete l; + removeLaunchConfigurationInternal( l ); } } d->launchConfigurationTypes.remove( type->id() ); @@ -833,14 +832,16 @@ launcherGroup.writeEntry( Strings::LaunchConfigurationsListEntry(), configs ); launcherGroup.sync(); - foreach( QAction* a, d->currentTargetAction->actions() ) - { - if( static_cast( a->data().value() ) == l ) - { + removeLaunchConfigurationInternal( l ); +} + +void RunController::removeLaunchConfigurationInternal(LaunchConfiguration *l) +{ + foreach( QAction* a, d->currentTargetAction->actions() ) { + if( static_cast( a->data().value() ) == l ) { bool wasSelected = a->isChecked(); d->currentTargetAction->removeAction( a ); - if( wasSelected && !d->currentTargetAction->actions().isEmpty() ) - { + if( wasSelected && !d->currentTargetAction->actions().isEmpty() ) { d->currentTargetAction->actions().at(0)->setChecked( true ); } break;