mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 22:36:57 +02:00
use an auto_ptr to be able to reset the AccountManager
This commit is contained in:
parent
909a6e89a8
commit
fed7dad2b6
3 changed files with 14 additions and 4 deletions
|
@ -81,6 +81,11 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
||||||
|
|
||||||
void DomainServer::restart() {
|
void DomainServer::restart() {
|
||||||
qDebug() << "domain-server is restarting.";
|
qDebug() << "domain-server is restarting.";
|
||||||
|
|
||||||
|
// make sure all static instances are reset
|
||||||
|
LimitedNodeList::getInstance()->reset();
|
||||||
|
AccountManager::getInstance(true);
|
||||||
|
|
||||||
exit(DomainServer::EXIT_CODE_REBOOT);
|
exit(DomainServer::EXIT_CODE_REBOOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,14 @@
|
||||||
|
|
||||||
const bool VERBOSE_HTTP_REQUEST_DEBUGGING = false;
|
const bool VERBOSE_HTTP_REQUEST_DEBUGGING = false;
|
||||||
|
|
||||||
AccountManager& AccountManager::getInstance() {
|
AccountManager& AccountManager::getInstance(bool forceReset) {
|
||||||
static AccountManager sharedInstance;
|
static std::auto_ptr<AccountManager> sharedInstance(new AccountManager());
|
||||||
return sharedInstance;
|
|
||||||
|
if (forceReset) {
|
||||||
|
sharedInstance.reset(new AccountManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
return *sharedInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(OAuthAccessToken)
|
Q_DECLARE_METATYPE(OAuthAccessToken)
|
||||||
|
|
|
@ -42,7 +42,7 @@ const QByteArray ACCESS_TOKEN_AUTHORIZATION_HEADER = "Authorization";
|
||||||
class AccountManager : public QObject {
|
class AccountManager : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static AccountManager& getInstance();
|
static AccountManager& getInstance(bool forceReset = false);
|
||||||
|
|
||||||
void authenticatedRequest(const QString& path,
|
void authenticatedRequest(const QString& path,
|
||||||
QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation,
|
QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation,
|
||||||
|
|
Loading…
Reference in a new issue