Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
Code looks valid, but valgrind is reporting a leak here. In any
case Qt docs suggest not to use addAction and parent the
actions to the QActionGroup instead, so let's do that (and
it solves the reported leak)
  • Loading branch information
nyalldawson committed May 1, 2018
1 parent b683291 commit 9ff366f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -2419,10 +2419,9 @@ void QgisApp::refreshProfileMenu()
Q_FOREACH ( const QString &name, userProfileManager()->allProfiles() )
{
std::unique_ptr< QgsUserProfile > namedProfile( userProfileManager()->profileForName( name ) );
QAction *action = new QAction( namedProfile->icon(), namedProfile->alias(), mConfigMenu );
QAction *action = new QAction( namedProfile->icon(), namedProfile->alias(), profileGroup );
action->setToolTip( namedProfile->folder() );
action->setCheckable( true );
profileGroup->addAction( action );
mConfigMenu->addAction( action );

if ( name == activeName )
Expand Down

0 comments on commit 9ff366f

Please sign in to comment.