mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-03 10:25:02 +00:00
Fix singleton class ownership
We shouldn't allow Qt parent ownership in here.
This commit is contained in:
parent
fa43dab3a2
commit
a6cdba17f0
@ -550,7 +550,7 @@ int Application::exec(const QStringList ¶ms)
|
|||||||
#ifndef DISABLE_COUNTRIES_RESOLUTION
|
#ifndef DISABLE_COUNTRIES_RESOLUTION
|
||||||
Net::GeoIPManager::initInstance();
|
Net::GeoIPManager::initInstance();
|
||||||
#endif
|
#endif
|
||||||
ScanFoldersModel::initInstance(this);
|
ScanFoldersModel::initInstance();
|
||||||
|
|
||||||
#ifndef DISABLE_WEBUI
|
#ifndef DISABLE_WEBUI
|
||||||
m_webui = new WebUI;
|
m_webui = new WebUI;
|
||||||
|
@ -57,14 +57,10 @@ struct ScanFoldersModel::PathData
|
|||||||
|
|
||||||
ScanFoldersModel *ScanFoldersModel::m_instance = nullptr;
|
ScanFoldersModel *ScanFoldersModel::m_instance = nullptr;
|
||||||
|
|
||||||
bool ScanFoldersModel::initInstance(QObject *parent)
|
void ScanFoldersModel::initInstance()
|
||||||
{
|
{
|
||||||
if (!m_instance) {
|
if (!m_instance)
|
||||||
m_instance = new ScanFoldersModel(parent);
|
m_instance = new ScanFoldersModel;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScanFoldersModel::freeInstance()
|
void ScanFoldersModel::freeInstance()
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
CUSTOM_LOCATION
|
CUSTOM_LOCATION
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool initInstance(QObject *parent = nullptr);
|
static void initInstance();
|
||||||
static void freeInstance();
|
static void freeInstance();
|
||||||
static ScanFoldersModel *instance();
|
static ScanFoldersModel *instance();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user