mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
replace auto_ptr with unique_ptr
This commit is contained in:
parent
287ab61618
commit
fce239fb70
4 changed files with 7 additions and 7 deletions
|
@ -30,7 +30,7 @@
|
||||||
const bool VERBOSE_HTTP_REQUEST_DEBUGGING = false;
|
const bool VERBOSE_HTTP_REQUEST_DEBUGGING = false;
|
||||||
|
|
||||||
AccountManager& AccountManager::getInstance(bool forceReset) {
|
AccountManager& AccountManager::getInstance(bool forceReset) {
|
||||||
static std::auto_ptr<AccountManager> sharedInstance(new AccountManager());
|
static std::unique_ptr<AccountManager> sharedInstance(new AccountManager());
|
||||||
|
|
||||||
if (forceReset) {
|
if (forceReset) {
|
||||||
sharedInstance.reset(new AccountManager());
|
sharedInstance.reset(new AccountManager());
|
||||||
|
|
|
@ -38,19 +38,19 @@ const char SOLO_NODE_TYPES[2] = {
|
||||||
|
|
||||||
const QUrl DEFAULT_NODE_AUTH_URL = QUrl("https://data.highfidelity.io");
|
const QUrl DEFAULT_NODE_AUTH_URL = QUrl("https://data.highfidelity.io");
|
||||||
|
|
||||||
std::auto_ptr<LimitedNodeList> LimitedNodeList::_sharedInstance;
|
std::unique_ptr<LimitedNodeList> LimitedNodeList::_sharedInstance;
|
||||||
|
|
||||||
LimitedNodeList* LimitedNodeList::createInstance(unsigned short socketListenPort, unsigned short dtlsPort) {
|
LimitedNodeList* LimitedNodeList::createInstance(unsigned short socketListenPort, unsigned short dtlsPort) {
|
||||||
NodeType::init();
|
NodeType::init();
|
||||||
|
|
||||||
if (_sharedInstance.get()) {
|
if (_sharedInstance.get()) {
|
||||||
qDebug() << "LimitedNodeList called with existing instance." <<
|
qDebug() << "LimitedNodeList called with existing instance." <<
|
||||||
"Releasing auto_ptr, deleting existing instance and creating a new one.";
|
"Releasing unique_ptr, deleting existing instance and creating a new one.";
|
||||||
|
|
||||||
delete _sharedInstance.release();
|
delete _sharedInstance.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
_sharedInstance = std::auto_ptr<LimitedNodeList>(new LimitedNodeList(socketListenPort, dtlsPort));
|
_sharedInstance = std::move(std::unique_ptr<LimitedNodeList>(new LimitedNodeList(socketListenPort, dtlsPort)));
|
||||||
|
|
||||||
// register the SharedNodePointer meta-type for signals/slots
|
// register the SharedNodePointer meta-type for signals/slots
|
||||||
qRegisterMetaType<SharedNodePointer>();
|
qRegisterMetaType<SharedNodePointer>();
|
||||||
|
|
|
@ -177,7 +177,7 @@ signals:
|
||||||
void localSockAddrChanged(const HifiSockAddr& localSockAddr);
|
void localSockAddrChanged(const HifiSockAddr& localSockAddr);
|
||||||
void publicSockAddrChanged(const HifiSockAddr& publicSockAddr);
|
void publicSockAddrChanged(const HifiSockAddr& publicSockAddr);
|
||||||
protected:
|
protected:
|
||||||
static std::auto_ptr<LimitedNodeList> _sharedInstance;
|
static std::unique_ptr<LimitedNodeList> _sharedInstance;
|
||||||
|
|
||||||
LimitedNodeList(unsigned short socketListenPort, unsigned short dtlsListenPort);
|
LimitedNodeList(unsigned short socketListenPort, unsigned short dtlsListenPort);
|
||||||
LimitedNodeList(LimitedNodeList const&); // Don't implement, needed to avoid copies of singleton
|
LimitedNodeList(LimitedNodeList const&); // Don't implement, needed to avoid copies of singleton
|
||||||
|
|
|
@ -31,12 +31,12 @@ NodeList* NodeList::createInstance(char ownerType, unsigned short socketListenPo
|
||||||
|
|
||||||
if (_sharedInstance.get()) {
|
if (_sharedInstance.get()) {
|
||||||
qDebug() << "NodeList called with existing instance." <<
|
qDebug() << "NodeList called with existing instance." <<
|
||||||
"Releasing auto_ptr, deleting existing instance and creating a new one.";
|
"Releasing unique_ptr, deleting existing instance and creating a new one.";
|
||||||
|
|
||||||
delete _sharedInstance.release();
|
delete _sharedInstance.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
_sharedInstance = std::auto_ptr<LimitedNodeList>(new NodeList(ownerType, socketListenPort, dtlsPort));
|
_sharedInstance = std::move(std::unique_ptr<LimitedNodeList>(new NodeList(ownerType, socketListenPort, dtlsPort)));
|
||||||
|
|
||||||
// register the SharedNodePointer meta-type for signals/slots
|
// register the SharedNodePointer meta-type for signals/slots
|
||||||
qRegisterMetaType<SharedNodePointer>();
|
qRegisterMetaType<SharedNodePointer>();
|
||||||
|
|
Loading…
Reference in a new issue