Skip to content
Permalink
Browse files

Use local statics

  • Loading branch information
nyalldawson committed Nov 7, 2017
1 parent ca0c830 commit 5b9283fcb9c6177c8876c95dc4d2295968647adb
Showing with 2 additions and 7 deletions.
  1. +2 −2 src/core/qgsapplication.cpp
  2. +0 −5 src/core/qgsapplication.h
@@ -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 )
@@ -903,6 +901,7 @@ QgsAuthManager *QgsApplication::authManager()
else
{
// no QgsApplication instance
static QgsAuthManager *sAuthManager = nullptr;
if ( !sAuthManager )
sAuthManager = QgsAuthManager::instance();
return sAuthManager;
@@ -1572,6 +1571,7 @@ QgsDataItemProviderRegistry *QgsApplication::dataItemProviderRegistry()
else
{
// no QgsApplication instance
static QgsDataItemProviderRegistry *sDataItemProviderRegistry = nullptr;
if ( !sDataItemProviderRegistry )
sDataItemProviderRegistry = new QgsDataItemProviderRegistry();
return sDataItemProviderRegistry;
@@ -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
{

0 comments on commit 5b9283f

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