NOISSUE fix horrible globals crash
FIXME: remove all globals.
This commit is contained in:
parent
07589b5114
commit
dae3b06885
@ -22,6 +22,8 @@ public:
|
|||||||
QString m_wonkoRootUrl;
|
QString m_wonkoRootUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Env * instance;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The *NEW* global rat nest of an object. Handle with care.
|
* The *NEW* global rat nest of an object. Handle with care.
|
||||||
*/
|
*/
|
||||||
@ -38,8 +40,17 @@ Env::~Env()
|
|||||||
|
|
||||||
Env& Env::Env::getInstance()
|
Env& Env::Env::getInstance()
|
||||||
{
|
{
|
||||||
static Env instance;
|
if(!instance)
|
||||||
return instance;
|
{
|
||||||
|
instance = new Env();
|
||||||
|
}
|
||||||
|
return *instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Env::dispose()
|
||||||
|
{
|
||||||
|
delete instance;
|
||||||
|
instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_qobject_ptr< HttpMetaCache > Env::metacache()
|
shared_qobject_ptr< HttpMetaCache > Env::metacache()
|
||||||
|
@ -27,6 +27,7 @@ private:
|
|||||||
class Private;
|
class Private;
|
||||||
Env();
|
Env();
|
||||||
~Env();
|
~Env();
|
||||||
|
static void dispose();
|
||||||
public:
|
public:
|
||||||
static Env& getInstance();
|
static Env& getInstance();
|
||||||
|
|
||||||
|
@ -319,6 +319,7 @@ MultiMC::~MultiMC()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
shutdownLogger();
|
shutdownLogger();
|
||||||
|
Env::dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiMC::messageReceived(const QString& message)
|
void MultiMC::messageReceived(const QString& message)
|
||||||
|
Loading…
Reference in New Issue
Block a user