@@ -91,9 +91,13 @@ QString ABISYM( QgsApplication::mLibraryPath );
91
91
QString ABISYM ( QgsApplication::mLibexecPath );
92
92
QString ABISYM ( QgsApplication::mThemeName );
93
93
QString ABISYM ( QgsApplication::mUIThemeName );
94
+ QString ABISYM ( QgsApplication::mProfilePath );
95
+
94
96
QStringList ABISYM ( QgsApplication::mDefaultSvgPaths );
95
97
QMap<QString, QString> ABISYM ( QgsApplication::mSystemEnvVars );
96
98
QString ABISYM ( QgsApplication::mConfigPath );
99
+
100
+ bool ABISYM ( QgsApplication::mInitialized ) = false;
97
101
bool ABISYM ( QgsApplication::mRunningFromBuildDir ) = false;
98
102
QString ABISYM ( QgsApplication::mBuildSourcePath );
99
103
#ifdef _MSC_VER
@@ -121,7 +125,7 @@ QgsApplication::QgsApplication( int &argc, char **argv, bool GUIenabled, const Q
121
125
122
126
mApplicationMembers = new ApplicationMembers ();
123
127
124
- init ( profileFolder ); // init can also be called directly by e.g. unit tests that don't inherit QApplication.
128
+ ABISYM ( mProfilePath ) = profileFolder;
125
129
}
126
130
127
131
void QgsApplication::init ( QString profileFolder )
@@ -146,6 +150,8 @@ void QgsApplication::init( QString profileFolder )
146
150
delete profile;
147
151
}
148
152
153
+ ABISYM ( mProfilePath ) = profileFolder;
154
+
149
155
qRegisterMetaType<QgsGeometry::Error>( " QgsGeometry::Error" );
150
156
qRegisterMetaType<QgsProcessingFeatureSourceDefinition>( " QgsProcessingFeatureSourceDefinition" );
151
157
qRegisterMetaType<QgsProcessingOutputLayerDefinition>( " QgsProcessingOutputLayerDefinition" );
@@ -259,6 +265,8 @@ void QgsApplication::init( QString profileFolder )
259
265
// this should be read from QgsSettings but we don't know where they are at this point
260
266
// so we read actual value in main.cpp
261
267
ABISYM ( mMaxThreads ) = -1 ;
268
+
269
+ ABISYM ( mInitialized ) = true ;
262
270
}
263
271
264
272
QgsApplication::~QgsApplication ()
@@ -589,14 +597,14 @@ QString QgsApplication::resolvePkgPath()
589
597
Q_FOREACH ( const QString &path, QStringList () << " " << " /.." << " /bin" << " /../../.." )
590
598
{
591
599
f.setFileName ( prefixPath + path + " /qgisbuildpath.txt" );
592
- QgsDebugMsg (f.fileName ());
600
+ QgsDebugMsg ( f.fileName () );
593
601
if ( f.exists () )
594
602
break ;
595
603
}
596
604
597
605
if ( f.exists () && f.open ( QIODevice::ReadOnly ) )
598
606
{
599
- QgsDebugMsg (" Running from build dir!" );
607
+ QgsDebugMsg ( " Running from build dir!" );
600
608
return f.readLine ().trimmed ();
601
609
}
602
610
else
@@ -980,6 +988,11 @@ QgsApplication::endian_t QgsApplication::endian()
980
988
981
989
void QgsApplication::initQgis ()
982
990
{
991
+ if ( !ABISYM ( mInitialized ) )
992
+ {
993
+ init ( ABISYM ( mProfilePath ) );
994
+ }
995
+
983
996
// set the provider plugin path (this creates provider registry)
984
997
QgsProviderRegistry::instance ( pluginPath () );
985
998
0 commit comments