Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix memory leak
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)

(cherry-picked from 9ff366f)
  • Loading branch information
nyalldawson committed May 3, 2018
1 parent 14f0a83 commit c5e7998
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -2351,10 +2351,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 c5e7998

Please sign in to comment.