Skip to content

Commit 10db1c8

Browse files
committed
A bit more RAII
1 parent 3a5e96a commit 10db1c8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/app/main.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -830,17 +830,16 @@ int main( int argc, char *argv[] )
830830
}
831831
}
832832

833-
QSettings *globalSettings = new QSettings( globalsettingsfile, QSettings::IniFormat );
834-
globalSettings->setIniCodec( "UTF-8" );
835833
if ( configLocalStorageLocation.isEmpty() )
836834
{
835+
QSettings globalSettings( globalsettingsfile, QSettings::IniFormat );
837836
if ( getenv( "QGIS_CUSTOM_CONFIG_PATH" ) )
838837
{
839838
configLocalStorageLocation = getenv( "QGIS_CUSTOM_CONFIG_PATH" );
840839
}
841-
else if ( globalSettings->contains( QStringLiteral( "core/profilesPath" ) ) )
840+
else if ( globalSettings.contains( QStringLiteral( "core/profilesPath" ) ) )
842841
{
843-
configLocalStorageLocation = globalSettings->value( QStringLiteral( "core/profilesPath" ), "" ).toString();
842+
configLocalStorageLocation = globalSettings.value( QStringLiteral( "core/profilesPath" ), "" ).toString();
844843
QgsDebugMsg( QString( "Loading profiles path from global config at %1" ).arg( configLocalStorageLocation ) );
845844
}
846845

@@ -850,7 +849,6 @@ int main( int argc, char *argv[] )
850849
configLocalStorageLocation = QStandardPaths::standardLocations( QStandardPaths::AppDataLocation ).value( 0 );
851850
}
852851
}
853-
delete globalSettings;
854852

855853
QString rootProfileFolder = QgsUserProfileManager::resolveProfilesFolder( configLocalStorageLocation );
856854
QgsUserProfileManager manager( rootProfileFolder );

0 commit comments

Comments
 (0)