overte/libraries/shared/src/DependencyManager.cpp
Anthony Thibault fe17550a80 Code review feedback
In DependencyManager::set<>() destroy the clear the previous before allocating the new instance.
2019-05-10 15:41:52 -07:00

28 lines
785 B
C++

//
// DependencyManager.cpp
//
//
// Created by Clément Brisset on 12/10/14.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "DependencyManager.h"
#include "SharedUtil.h"
#include "Finally.h"
static const char* const DEPENDENCY_PROPERTY_NAME = "com.highfidelity.DependencyMananger";
DependencyManager& DependencyManager::manager() {
static DependencyManager* instance = globalInstance<DependencyManager>(DEPENDENCY_PROPERTY_NAME);
return *instance;
}
QSharedPointer<Dependency> DependencyManager::safeGet(size_t hashCode) const {
QMutexLocker lock(&_instanceHashMutex);
return _instanceHash.value(hashCode);
}