Skip to content

Commit

Permalink
Use local statics
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 7, 2017
1 parent ca0c830 commit 5b9283f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/core/qgsapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ const char *QgsApplication::QGIS_ORGANIZATION_DOMAIN = "qgis.org";
const char *QgsApplication::QGIS_APPLICATION_NAME = "QGIS3";

QgsApplication::ApplicationMembers *QgsApplication::sApplicationMembers = nullptr;
QgsAuthManager *QgsApplication::sAuthManager = nullptr;
QgsDataItemProviderRegistry *QgsApplication::sDataItemProviderRegistry = nullptr;

QgsApplication::QgsApplication( int &argc, char **argv, bool GUIenabled, const QString &profileFolder, const QString &platformName )
: QApplication( argc, argv, GUIenabled )
Expand Down Expand Up @@ -903,6 +901,7 @@ QgsAuthManager *QgsApplication::authManager()
else
{
// no QgsApplication instance
static QgsAuthManager *sAuthManager = nullptr;
if ( !sAuthManager )
sAuthManager = QgsAuthManager::instance();
return sAuthManager;
Expand Down Expand Up @@ -1572,6 +1571,7 @@ QgsDataItemProviderRegistry *QgsApplication::dataItemProviderRegistry()
else
{
// no QgsApplication instance
static QgsDataItemProviderRegistry *sDataItemProviderRegistry = nullptr;
if ( !sDataItemProviderRegistry )
sDataItemProviderRegistry = new QgsDataItemProviderRegistry();
return sDataItemProviderRegistry;
Expand Down
5 changes: 0 additions & 5 deletions src/core/qgsapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -749,12 +749,7 @@ class CORE_EXPORT QgsApplication : public QApplication
QMap<QString, QIcon> mIconCache;

QgsDataItemProviderRegistry *mDataItemProviderRegistry = nullptr;
// ... but in case QgsApplication is never instantiated (eg with custom designer widgets), we fall back to static instance
static QgsDataItemProviderRegistry *sDataItemProviderRegistry;

QgsAuthManager *mAuthManager = nullptr;
// ... but in case QgsApplication is never instantiated (eg with custom designer widgets), we fall back to static instance
static QgsAuthManager *sAuthManager;

struct ApplicationMembers
{
Expand Down

0 comments on commit 5b9283f

Please sign in to comment.