Skip to content
Permalink
Browse files

do not write logs before QgsApplication instace

because otherwise it creates a QgsProject without a QgsApplication
and translation won't work anymore because it cannot connect the signal to the slot

this fixes #20561

(partly copied from 8e7d37e)
  • Loading branch information
signedav committed Dec 6, 2018
1 parent 7f5afe6 commit d3d5d7e57347016a92c5b566869a2485b1269771
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/app/main.cpp
@@ -432,6 +432,9 @@ APP_EXPORT
#endif
int main( int argc, char *argv[] )
{
//log messages written before creating QgsApplicatoin
QStringList preApplicationLogMessages;

#ifdef Q_OS_MACX
// Increase file resource limits (i.e., number of allowed open files)
// (from code provided by Larry Biehl, Purdue University, USA, from 'MultiSpec' project)
@@ -868,11 +871,11 @@ int main( int argc, char *argv[] )
{
if ( !QgsSettings::setGlobalSettingsPath( globalsettingsfile ) )
{
QgsMessageLog::logMessage( QObject::tr( "Invalid globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
preApplicationLogMessages << QObject::tr( "Invalid globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" );
}
else
{
QgsMessageLog::logMessage( QObject::tr( "Successfully loaded globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" ) );
preApplicationLogMessages << QObject::tr( "Successfully loaded globalsettingsfile path: %1" ).arg( globalsettingsfile ), QStringLiteral( "QGIS" );
}
}

@@ -972,6 +975,10 @@ int main( int argc, char *argv[] )

QgsApplication myApp( argc, argv, myUseGuiFlag );

//write the log messages written before creating QgsApplicatoin
for ( QString const &preApplicationLogMessage : preApplicationLogMessages )
QgsMessageLog::logMessage( preApplicationLogMessage );

// Settings migration is only supported on the default profile for now.
if ( profileName == QLatin1String( "default" ) )
{

0 comments on commit d3d5d7e

Please sign in to comment.
You can’t perform that action at this time.