Skip to content

Commit def29e8

Browse files
authoredDec 6, 2018
Merge pull request #8601 from signedav/fix-ts-file
[Bugfix] .qgs-translation fix: do not create QgsProject before QgsApplication
2 parents ba88a10 + 2a86b6e commit def29e8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

‎src/app/main.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,9 @@ APP_EXPORT
430430
#endif
431431
int main( int argc, char *argv[] )
432432
{
433+
//log messages written before creating QgsApplication
434+
QStringList preApplicationLogMessages;
435+
433436
#ifdef Q_OS_MACX
434437
// Increase file resource limits (i.e., number of allowed open files)
435438
// (from code provided by Larry Biehl, Purdue University, USA, from 'MultiSpec' project)
@@ -866,11 +869,11 @@ int main( int argc, char *argv[] )
866869
{
867870
if ( !QgsSettings::setGlobalSettingsPath( globalsettingsfile ) )
868871
{
869-
QgsMessageLog::logMessage( QObject::tr( "Invalid globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
872+
preApplicationLogMessages << QObject::tr( "Invalid globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" );
870873
}
871874
else
872875
{
873-
QgsMessageLog::logMessage( QObject::tr( "Successfully loaded globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
876+
preApplicationLogMessages << QObject::tr( "Successfully loaded globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" );
874877
}
875878
}
876879

@@ -970,6 +973,10 @@ int main( int argc, char *argv[] )
970973

971974
QgsApplication myApp( argc, argv, myUseGuiFlag );
972975

976+
//write the log messages written before creating QgsApplication
977+
for ( const QString &preApplicationLogMessage : qgis::as_const( preApplicationLogMessages ) )
978+
QgsMessageLog::logMessage( preApplicationLogMessage );
979+
973980
// Settings migration is only supported on the default profile for now.
974981
if ( profileName == QLatin1String( "default" ) )
975982
{

0 commit comments

Comments
 (0)