Make IdentityManager a singleton

This commit is contained in:
Cameron Gutman
2018-06-26 19:01:40 -07:00
parent 6c8349787a
commit bb95c4db78
8 changed files with 37 additions and 25 deletions

View File

@@ -13,6 +13,20 @@
#include <openssl/bn.h>
#include <openssl/x509.h>
IdentityManager* IdentityManager::s_Im = nullptr;
IdentityManager*
IdentityManager::get()
{
// This will always be called first on the main thread,
// so it's safe to initialize without locks.
if (s_Im == nullptr) {
s_Im = new IdentityManager();
}
return s_Im;
}
IdentityManager::IdentityManager()
{
m_RootDirectory = QDir(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation));