mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 15:59:49 +02:00
repair badly scoped usage of QMutexLocker
This commit is contained in:
parent
99cd6c8ce8
commit
594165782a
3 changed files with 15 additions and 15 deletions
|
@ -2006,7 +2006,7 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::
|
||||||
PerformanceWarning warn(showWarnings, "Application::updateAvatars()");
|
PerformanceWarning warn(showWarnings, "Application::updateAvatars()");
|
||||||
|
|
||||||
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
|
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
|
||||||
QMutexLocker(&node->getMutex());
|
QMutexLocker locker(&node->getMutex());
|
||||||
if (node->getLinkedData()) {
|
if (node->getLinkedData()) {
|
||||||
Avatar *avatar = (Avatar *)node->getLinkedData();
|
Avatar *avatar = (Avatar *)node->getLinkedData();
|
||||||
if (!avatar->isInitialized()) {
|
if (!avatar->isInitialized()) {
|
||||||
|
@ -3659,7 +3659,7 @@ void Application::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) {
|
||||||
NodeList* nodeList = NodeList::getInstance();
|
NodeList* nodeList = NodeList::getInstance();
|
||||||
|
|
||||||
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
|
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
|
||||||
QMutexLocker(&node->getMutex());
|
QMutexLocker locker(&node->getMutex());
|
||||||
|
|
||||||
if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
|
if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
|
||||||
Avatar *avatar = (Avatar *)node->getLinkedData();
|
Avatar *avatar = (Avatar *)node->getLinkedData();
|
||||||
|
|
|
@ -231,7 +231,7 @@ void NodeList::processBulkNodeData(const HifiSockAddr& senderAddress, unsigned c
|
||||||
}
|
}
|
||||||
|
|
||||||
int NodeList::updateNodeWithData(Node *node, const HifiSockAddr& senderSockAddr, unsigned char *packetData, int dataBytes) {
|
int NodeList::updateNodeWithData(Node *node, const HifiSockAddr& senderSockAddr, unsigned char *packetData, int dataBytes) {
|
||||||
QMutexLocker(&node->getMutex());
|
QMutexLocker locker(&node->getMutex());
|
||||||
|
|
||||||
node->setLastHeardMicrostamp(usecTimestampNow());
|
node->setLastHeardMicrostamp(usecTimestampNow());
|
||||||
|
|
||||||
|
@ -267,16 +267,19 @@ SharedNodePointer NodeList::nodeWithAddress(const HifiSockAddr &senderSockAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedNodePointer NodeList::nodeWithUUID(const QUuid& nodeUUID) {
|
SharedNodePointer NodeList::nodeWithUUID(const QUuid& nodeUUID) {
|
||||||
_nodeHashMutex.lock();
|
QMutexLocker locker(&_nodeHashMutex);
|
||||||
SharedNodePointer matchingNode = _nodeHash.value(nodeUUID);
|
return _nodeHash.value(nodeUUID);
|
||||||
_nodeHashMutex.unlock();
|
}
|
||||||
return matchingNode;
|
|
||||||
|
NodeHash NodeList::getNodeHash() {
|
||||||
|
QMutexLocker locker(&_nodeHashMutex);
|
||||||
|
return NodeHash(_nodeHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeList::clear() {
|
void NodeList::clear() {
|
||||||
qDebug() << "Clearing the NodeList. Deleting all nodes in list.";
|
qDebug() << "Clearing the NodeList. Deleting all nodes in list.";
|
||||||
|
|
||||||
_nodeHashMutex.lock();
|
QMutexLocker locker(&_nodeHashMutex);
|
||||||
|
|
||||||
NodeHash::iterator nodeItem = _nodeHash.begin();
|
NodeHash::iterator nodeItem = _nodeHash.begin();
|
||||||
|
|
||||||
|
@ -284,8 +287,6 @@ void NodeList::clear() {
|
||||||
while (nodeItem != _nodeHash.end()) {
|
while (nodeItem != _nodeHash.end()) {
|
||||||
nodeItem = killNodeAtHashIterator(nodeItem);
|
nodeItem = killNodeAtHashIterator(nodeItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
_nodeHashMutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeList::reset() {
|
void NodeList::reset() {
|
||||||
|
@ -444,14 +445,12 @@ void NodeList::processSTUNResponse(unsigned char* packetData, size_t dataBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeList::killNodeWithUUID(const QUuid& nodeUUID) {
|
void NodeList::killNodeWithUUID(const QUuid& nodeUUID) {
|
||||||
_nodeHashMutex.lock();
|
QMutexLocker locker(&_nodeHashMutex);
|
||||||
|
|
||||||
NodeHash::iterator nodeItemToKill = _nodeHash.find(nodeUUID);
|
NodeHash::iterator nodeItemToKill = _nodeHash.find(nodeUUID);
|
||||||
if (nodeItemToKill != _nodeHash.end()) {
|
if (nodeItemToKill != _nodeHash.end()) {
|
||||||
killNodeAtHashIterator(nodeItemToKill);
|
killNodeAtHashIterator(nodeItemToKill);
|
||||||
}
|
}
|
||||||
|
|
||||||
_nodeHashMutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeHash::iterator NodeList::killNodeAtHashIterator(NodeHash::iterator& nodeItemToKill) {
|
NodeHash::iterator NodeList::killNodeAtHashIterator(NodeHash::iterator& nodeItemToKill) {
|
||||||
|
@ -705,7 +704,7 @@ SharedNodePointer NodeList::addOrUpdateNode(const QUuid& uuid, char nodeType,
|
||||||
} else {
|
} else {
|
||||||
_nodeHashMutex.unlock();
|
_nodeHashMutex.unlock();
|
||||||
|
|
||||||
QMutexLocker(&matchingNode->getMutex());
|
QMutexLocker locker(&matchingNode->getMutex());
|
||||||
|
|
||||||
if (matchingNode->getType() == NODE_TYPE_AUDIO_MIXER ||
|
if (matchingNode->getType() == NODE_TYPE_AUDIO_MIXER ||
|
||||||
matchingNode->getType() == NODE_TYPE_VOXEL_SERVER ||
|
matchingNode->getType() == NODE_TYPE_VOXEL_SERVER ||
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <unistd.h> // not on windows, not needed for mac or windows
|
#include <unistd.h> // not on windows, not needed for mac or windows
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <QtCore/QMutex>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
#include <QtCore/QSharedPointer>
|
#include <QtCore/QSharedPointer>
|
||||||
#include <QtNetwork/QHostAddress>
|
#include <QtNetwork/QHostAddress>
|
||||||
|
@ -81,7 +82,7 @@ public:
|
||||||
|
|
||||||
void(*linkedDataCreateCallback)(Node *);
|
void(*linkedDataCreateCallback)(Node *);
|
||||||
|
|
||||||
const NodeHash& getNodeHash() { return _nodeHash; }
|
NodeHash getNodeHash();
|
||||||
int size() const { return _nodeHash.size(); }
|
int size() const { return _nodeHash.size(); }
|
||||||
|
|
||||||
int getNumNoReplyDomainCheckIns() const { return _numNoReplyDomainCheckIns; }
|
int getNumNoReplyDomainCheckIns() const { return _numNoReplyDomainCheckIns; }
|
||||||
|
|
Loading…
Reference in a new issue