From 0778fbaea9a45446a2acacbb53b792d0ebe73845 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 7 Jul 2017 15:58:39 -0700 Subject: [PATCH 1/6] Fix Debug Mode Assert --- assignment-client/src/Agent.cpp | 3 +++ assignment-client/src/scripts/EntityScriptServer.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 8aec5adb1f..f9b8087f94 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -80,6 +81,8 @@ Agent::Agent(ReceivedMessage& message) : DependencyManager::set(); DependencyManager::set(); + + DebugDraw::getInstance(); auto& packetReceiver = DependencyManager::get()->getPacketReceiver(); diff --git a/assignment-client/src/scripts/EntityScriptServer.cpp b/assignment-client/src/scripts/EntityScriptServer.cpp index 489478ff9a..e8ea14f399 100644 --- a/assignment-client/src/scripts/EntityScriptServer.cpp +++ b/assignment-client/src/scripts/EntityScriptServer.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,8 @@ EntityScriptServer::EntityScriptServer(ReceivedMessage& message) : ThreadedAssig DependencyManager::set(); DependencyManager::set(ScriptEngine::ENTITY_SERVER_SCRIPT); + DebugDraw::getInstance(); + auto& packetReceiver = DependencyManager::get()->getPacketReceiver(); packetReceiver.registerListenerForTypes({ PacketType::OctreeStats, PacketType::EntityData, PacketType::EntityErase }, this, "handleOctreePacket"); From aa306c3450f048573e94fb6bb0ca0100c6871f4f Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 7 Jul 2017 17:01:07 -0700 Subject: [PATCH 2/6] Fix debug asserts on shutdown --- assignment-client/src/Agent.cpp | 1 + assignment-client/src/entities/EntityServer.cpp | 6 ++++++ assignment-client/src/entities/EntityServer.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index f9b8087f94..8710553027 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -801,6 +801,7 @@ void Agent::aboutToFinish() { emit stopAvatarAudioTimer(); _avatarAudioTimerThread.quit(); + _avatarAudioTimerThread.wait(); // cleanup codec & encoder if (_codec && _encoder) { diff --git a/assignment-client/src/entities/EntityServer.cpp b/assignment-client/src/entities/EntityServer.cpp index ac686e2e0a..2c8f8a9e37 100644 --- a/assignment-client/src/entities/EntityServer.cpp +++ b/assignment-client/src/entities/EntityServer.cpp @@ -50,6 +50,12 @@ EntityServer::~EntityServer() { tree->removeNewlyCreatedHook(this); } +void EntityServer::aboutToFinish() { + DependencyManager::get()->cleanup(); + + OctreeServer::aboutToFinish(); +} + void EntityServer::handleEntityPacket(QSharedPointer message, SharedNodePointer senderNode) { if (_octreeInboundPacketProcessor) { _octreeInboundPacketProcessor->queueReceivedPacket(message, senderNode); diff --git a/assignment-client/src/entities/EntityServer.h b/assignment-client/src/entities/EntityServer.h index 40676e79bd..26c2f149aa 100644 --- a/assignment-client/src/entities/EntityServer.h +++ b/assignment-client/src/entities/EntityServer.h @@ -59,6 +59,8 @@ public: virtual void trackSend(const QUuid& dataID, quint64 dataLastEdited, const QUuid& sessionID) override; virtual void trackViewerGone(const QUuid& sessionID) override; + virtual void aboutToFinish() override; + public slots: virtual void nodeAdded(SharedNodePointer node) override; virtual void nodeKilled(SharedNodePointer node) override; From 7160fca4f726044b5a4ee216be5bbe54d8f740c2 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 7 Jul 2017 17:14:08 -0700 Subject: [PATCH 3/6] Fix bad read access on shutdown --- assignment-client/src/audio/AudioMixerSlavePool.cpp | 2 +- assignment-client/src/avatars/AvatarMixerSlavePool.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assignment-client/src/audio/AudioMixerSlavePool.cpp b/assignment-client/src/audio/AudioMixerSlavePool.cpp index 643361ac5d..d2c19d97ba 100644 --- a/assignment-client/src/audio/AudioMixerSlavePool.cpp +++ b/assignment-client/src/audio/AudioMixerSlavePool.cpp @@ -76,7 +76,7 @@ void AudioMixerSlavePool::processPackets(ConstIter begin, ConstIter end) { void AudioMixerSlavePool::mix(ConstIter begin, ConstIter end, unsigned int frame, float throttlingRatio) { _function = &AudioMixerSlave::mix; - _configure = [&](AudioMixerSlave& slave) { + _configure = [=](AudioMixerSlave& slave) { slave.configureMix(_begin, _end, _frame, _throttlingRatio); }; _frame = frame; diff --git a/assignment-client/src/avatars/AvatarMixerSlavePool.cpp b/assignment-client/src/avatars/AvatarMixerSlavePool.cpp index cb5ae7735a..8afbc1cfe4 100644 --- a/assignment-client/src/avatars/AvatarMixerSlavePool.cpp +++ b/assignment-client/src/avatars/AvatarMixerSlavePool.cpp @@ -69,7 +69,7 @@ static AvatarMixerSlave slave; void AvatarMixerSlavePool::processIncomingPackets(ConstIter begin, ConstIter end) { _function = &AvatarMixerSlave::processIncomingPackets; - _configure = [&](AvatarMixerSlave& slave) { + _configure = [=](AvatarMixerSlave& slave) { slave.configure(begin, end); }; run(begin, end); @@ -79,7 +79,7 @@ void AvatarMixerSlavePool::broadcastAvatarData(ConstIter begin, ConstIter end, p_high_resolution_clock::time_point lastFrameTimestamp, float maxKbpsPerNode, float throttlingRatio) { _function = &AvatarMixerSlave::broadcastAvatarData; - _configure = [&](AvatarMixerSlave& slave) { + _configure = [=](AvatarMixerSlave& slave) { slave.configureBroadcast(begin, end, lastFrameTimestamp, maxKbpsPerNode, throttlingRatio); }; run(begin, end); From 80916b62bb2558c0e4db063bf4cd637f4f0cbda2 Mon Sep 17 00:00:00 2001 From: Tingjin Date: Tue, 11 Jul 2017 20:52:28 -0700 Subject: [PATCH 4/6] Remove unnecessary code Remove two lines of unnecessary code. --- interface/src/scripting/AudioDevices.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/interface/src/scripting/AudioDevices.cpp b/interface/src/scripting/AudioDevices.cpp index 98b8a7c12c..e26ebac3f1 100644 --- a/interface/src/scripting/AudioDevices.cpp +++ b/interface/src/scripting/AudioDevices.cpp @@ -131,7 +131,6 @@ void AudioDeviceList::resetDevice(bool contextIsHMD, const QString& device) { void AudioDeviceList::onDeviceChanged(const QAudioDeviceInfo& device) { auto oldDevice = _selectedDevice; _selectedDevice = device; - QModelIndex index; for (auto i = 0; i < _devices.size(); ++i) { AudioDevice& device = _devices[i]; @@ -139,7 +138,6 @@ void AudioDeviceList::onDeviceChanged(const QAudioDeviceInfo& device) { device.selected = false; } else if (device.info == _selectedDevice) { device.selected = true; - index = createIndex(i, 0); } } From f6d9a79fb5283798face33bfc68b231094b5eb5e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 12 Jul 2017 10:36:53 -0700 Subject: [PATCH 5/6] Revert "Revert "fix for invisible avatars after radius ignore"" --- .../src/avatars/AvatarMixerClientData.cpp | 3 --- interface/src/avatar/AvatarManager.cpp | 4 ---- .../src/avatars-renderer/Avatar.cpp | 3 +-- libraries/avatars/src/AvatarHashMap.cpp | 7 ------- libraries/avatars/src/AvatarHashMap.h | 1 - libraries/networking/src/NodeList.cpp | 20 ------------------- libraries/networking/src/NodeList.h | 4 ---- libraries/networking/src/udt/PacketHeaders.h | 1 - 8 files changed, 1 insertion(+), 42 deletions(-) diff --git a/assignment-client/src/avatars/AvatarMixerClientData.cpp b/assignment-client/src/avatars/AvatarMixerClientData.cpp index 4d80bc7d17..a4bf8fa253 100644 --- a/assignment-client/src/avatars/AvatarMixerClientData.cpp +++ b/assignment-client/src/avatars/AvatarMixerClientData.cpp @@ -108,9 +108,6 @@ void AvatarMixerClientData::ignoreOther(SharedNodePointer self, SharedNodePointe void AvatarMixerClientData::removeFromRadiusIgnoringSet(SharedNodePointer self, const QUuid& other) { if (isRadiusIgnoring(other)) { _radiusIgnoredOthers.erase(other); - auto exitingSpaceBubblePacket = NLPacket::create(PacketType::ExitingSpaceBubble, NUM_BYTES_RFC4122_UUID); - exitingSpaceBubblePacket->write(other.toRfc4122()); - DependencyManager::get()->sendUnreliablePacket(*exitingSpaceBubblePacket, *self); } } diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index c46d61cf68..3272bc3255 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -63,7 +63,6 @@ AvatarManager::AvatarManager(QObject* parent) : packetReceiver.registerListener(PacketType::BulkAvatarData, this, "processAvatarDataPacket"); packetReceiver.registerListener(PacketType::KillAvatar, this, "processKillAvatar"); packetReceiver.registerListener(PacketType::AvatarIdentity, this, "processAvatarIdentityPacket"); - packetReceiver.registerListener(PacketType::ExitingSpaceBubble, this, "processExitingSpaceBubble"); // when we hear that the user has ignored an avatar by session UUID // immediately remove that avatar instead of waiting for the absence of packets from avatar mixer @@ -320,9 +319,6 @@ void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar if (removalReason == KillAvatarReason::TheirAvatarEnteredYourBubble) { emit DependencyManager::get()->enteredIgnoreRadius(); - } - if (removalReason == KillAvatarReason::TheirAvatarEnteredYourBubble || removalReason == YourAvatarEnteredTheirBubble) { - DependencyManager::get()->radiusIgnoreNodeBySessionID(avatar->getSessionUUID(), true); } else if (removalReason == KillAvatarReason::AvatarDisconnected) { // remove from node sets, if present DependencyManager::get()->removeFromIgnoreMuteSets(avatar->getSessionUUID()); diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 2a223a1eaf..6e8f0f01e7 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -1453,8 +1453,7 @@ void Avatar::addToScene(AvatarSharedPointer myHandle, const render::ScenePointer if (scene) { auto nodelist = DependencyManager::get(); if (showAvatars - && !nodelist->isIgnoringNode(getSessionUUID()) - && !nodelist->isRadiusIgnoringNode(getSessionUUID())) { + && !nodelist->isIgnoringNode(getSessionUUID())) { render::Transaction transaction; addToScene(myHandle, scene, transaction); scene->enqueueTransaction(transaction); diff --git a/libraries/avatars/src/AvatarHashMap.cpp b/libraries/avatars/src/AvatarHashMap.cpp index e8c37bdaa8..3712080cdb 100644 --- a/libraries/avatars/src/AvatarHashMap.cpp +++ b/libraries/avatars/src/AvatarHashMap.cpp @@ -170,13 +170,6 @@ void AvatarHashMap::processKillAvatar(QSharedPointer message, S removeAvatar(sessionUUID, reason); } -void AvatarHashMap::processExitingSpaceBubble(QSharedPointer message, SharedNodePointer sendingNode) { - // read the node id - QUuid sessionUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID)); - auto nodeList = DependencyManager::get(); - nodeList->radiusIgnoreNodeBySessionID(sessionUUID, false); -} - void AvatarHashMap::removeAvatar(const QUuid& sessionUUID, KillAvatarReason removalReason) { QWriteLocker locker(&_hashLock); diff --git a/libraries/avatars/src/AvatarHashMap.h b/libraries/avatars/src/AvatarHashMap.h index 21ea8081c7..68fc232685 100644 --- a/libraries/avatars/src/AvatarHashMap.h +++ b/libraries/avatars/src/AvatarHashMap.h @@ -60,7 +60,6 @@ protected slots: void processAvatarDataPacket(QSharedPointer message, SharedNodePointer sendingNode); void processAvatarIdentityPacket(QSharedPointer message, SharedNodePointer sendingNode); void processKillAvatar(QSharedPointer message, SharedNodePointer sendingNode); - void processExitingSpaceBubble(QSharedPointer message, SharedNodePointer sendingNode); protected: AvatarHashMap(); diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 262f0318b6..7c479e1bff 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -241,10 +241,6 @@ void NodeList::reset() { _numNoReplyDomainCheckIns = 0; - // lock and clear our set of radius ignored IDs - _radiusIgnoredSetLock.lockForWrite(); - _radiusIgnoredNodeIDs.clear(); - _radiusIgnoredSetLock.unlock(); // lock and clear our set of ignored IDs _ignoredSetLock.lockForWrite(); _ignoredNodeIDs.clear(); @@ -810,22 +806,6 @@ void NodeList::sendIgnoreRadiusStateToNode(const SharedNodePointer& destinationN sendPacket(std::move(ignorePacket), *destinationNode); } -void NodeList::radiusIgnoreNodeBySessionID(const QUuid& nodeID, bool radiusIgnoreEnabled) { - if (radiusIgnoreEnabled) { - QReadLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // read lock for insert - // add this nodeID to our set of ignored IDs - _radiusIgnoredNodeIDs.insert(nodeID); - } else { - QWriteLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // write lock for unsafe_erase - _radiusIgnoredNodeIDs.unsafe_erase(nodeID); - } -} - -bool NodeList::isRadiusIgnoringNode(const QUuid& nodeID) const { - QReadLocker radiusIgnoredSetLocker{ &_radiusIgnoredSetLock }; // read lock for reading - return _radiusIgnoredNodeIDs.find(nodeID) != _radiusIgnoredNodeIDs.cend(); -} - void NodeList::ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled) { // enumerate the nodes to send a reliable ignore packet to each that can leverage it if (!nodeID.isNull() && _sessionUUID != nodeID) { diff --git a/libraries/networking/src/NodeList.h b/libraries/networking/src/NodeList.h index 6db760b3ca..b3a12153e5 100644 --- a/libraries/networking/src/NodeList.h +++ b/libraries/networking/src/NodeList.h @@ -77,8 +77,6 @@ public: void toggleIgnoreRadius() { ignoreNodesInRadius(!getIgnoreRadiusEnabled()); } void enableIgnoreRadius() { ignoreNodesInRadius(true); } void disableIgnoreRadius() { ignoreNodesInRadius(false); } - void radiusIgnoreNodeBySessionID(const QUuid& nodeID, bool radiusIgnoreEnabled); - bool isRadiusIgnoringNode(const QUuid& other) const; void ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled); bool isIgnoringNode(const QUuid& nodeID) const; void personalMuteNodeBySessionID(const QUuid& nodeID, bool muteEnabled); @@ -166,8 +164,6 @@ private: QTimer _keepAlivePingTimer; bool _requestsDomainListData; - mutable QReadWriteLock _radiusIgnoredSetLock; - tbb::concurrent_unordered_set _radiusIgnoredNodeIDs; mutable QReadWriteLock _ignoredSetLock; tbb::concurrent_unordered_set _ignoredNodeIDs; mutable QReadWriteLock _personalMutedSetLock; diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 6c42193e11..848bfd97cf 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -105,7 +105,6 @@ public: UsernameFromIDReply, ViewFrustum, RequestsDomainListData, - ExitingSpaceBubble, PerAvatarGainSet, EntityScriptGetStatus, EntityScriptGetStatusReply, From b3d73fd0dfdebfae602fc99970326b8d54482829 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Wed, 12 Jul 2017 10:39:15 -0700 Subject: [PATCH 6/6] Add comments to DebugDraw instanciation --- assignment-client/src/Agent.cpp | 3 ++- assignment-client/src/scripts/EntityScriptServer.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 8710553027..8b22d391d0 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -81,7 +81,8 @@ Agent::Agent(ReceivedMessage& message) : DependencyManager::set(); DependencyManager::set(); - + + // Needed to ensure the creation of the DebugDraw instance on the main thread DebugDraw::getInstance(); diff --git a/assignment-client/src/scripts/EntityScriptServer.cpp b/assignment-client/src/scripts/EntityScriptServer.cpp index e8ea14f399..e7433e7c05 100644 --- a/assignment-client/src/scripts/EntityScriptServer.cpp +++ b/assignment-client/src/scripts/EntityScriptServer.cpp @@ -68,6 +68,7 @@ EntityScriptServer::EntityScriptServer(ReceivedMessage& message) : ThreadedAssig DependencyManager::set(); DependencyManager::set(ScriptEngine::ENTITY_SERVER_SCRIPT); + // Needed to ensure the creation of the DebugDraw instance on the main thread DebugDraw::getInstance(); auto& packetReceiver = DependencyManager::get()->getPacketReceiver();