Browse Source

Merge pull request #11977 from Chocobo1/init

Fix singleton class ownership
adaptive-webui-19844
Mike Tzou 5 years ago committed by GitHub
parent
commit
8b330e3ac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app/application.cpp
  2. 10
      src/base/scanfoldersmodel.cpp
  3. 2
      src/base/scanfoldersmodel.h

2
src/app/application.cpp

@ -550,7 +550,7 @@ int Application::exec(const QStringList &params) @@ -550,7 +550,7 @@ int Application::exec(const QStringList &params)
#ifndef DISABLE_COUNTRIES_RESOLUTION
Net::GeoIPManager::initInstance();
#endif
ScanFoldersModel::initInstance(this);
ScanFoldersModel::initInstance();
#ifndef DISABLE_WEBUI
m_webui = new WebUI;

10
src/base/scanfoldersmodel.cpp

@ -57,14 +57,10 @@ struct ScanFoldersModel::PathData @@ -57,14 +57,10 @@ struct ScanFoldersModel::PathData
ScanFoldersModel *ScanFoldersModel::m_instance = nullptr;
bool ScanFoldersModel::initInstance(QObject *parent)
void ScanFoldersModel::initInstance()
{
if (!m_instance) {
m_instance = new ScanFoldersModel(parent);
return true;
}
return false;
if (!m_instance)
m_instance = new ScanFoldersModel;
}
void ScanFoldersModel::freeInstance()

2
src/base/scanfoldersmodel.h

@ -65,7 +65,7 @@ public: @@ -65,7 +65,7 @@ public:
CUSTOM_LOCATION
};
static bool initInstance(QObject *parent = nullptr);
static void initInstance();
static void freeInstance();
static ScanFoldersModel *instance();

Loading…
Cancel
Save