From 039bdc8900bd11597c49a20a653159bc4be91db1 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Wed, 15 Jul 2015 14:06:39 -0700 Subject: [PATCH 1/3] Check dependencyManager return value --- interface/src/octree/OctreePacketProcessor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interface/src/octree/OctreePacketProcessor.cpp b/interface/src/octree/OctreePacketProcessor.cpp index a7cb1aaa66..fbd22db558 100644 --- a/interface/src/octree/OctreePacketProcessor.cpp +++ b/interface/src/octree/OctreePacketProcessor.cpp @@ -28,7 +28,10 @@ OctreePacketProcessor::OctreePacketProcessor() { } OctreePacketProcessor::~OctreePacketProcessor() { - DependencyManager::get()->getPacketReceiver().unregisterListener(this); + auto nodelist = DependencyManager::get(); + if (nodelist) { + nodelist->getPacketReceiver().unregisterListener(this); + } } void OctreePacketProcessor::handleOctreePacket(QSharedPointer packet, SharedNodePointer senderNode) { From 85391cefbb65bd99b8e14315fbfe48ba483d3171 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Wed, 15 Jul 2015 15:26:22 -0700 Subject: [PATCH 2/3] Bug fixes --- libraries/networking/src/LimitedNodeList.cpp | 2 +- libraries/networking/src/udt/Packet.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index 9fe0648a4b..b57ea3081a 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -496,7 +496,7 @@ unsigned int LimitedNodeList::broadcastToNodes(std::unique_ptr packet, unsigned int n = 0; eachNode([&](const SharedNodePointer& node){ - if (destinationNodeTypes.contains(node->getType())) { + if (!node->getActiveSocket()->isNull() && destinationNodeTypes.contains(node->getType())) { writePacket(*packet, *node->getActiveSocket(), node->getConnectionSecret()); ++n; } diff --git a/libraries/networking/src/udt/Packet.cpp b/libraries/networking/src/udt/Packet.cpp index cfa90a43e4..f3448b15ad 100644 --- a/libraries/networking/src/udt/Packet.cpp +++ b/libraries/networking/src/udt/Packet.cpp @@ -147,7 +147,7 @@ void Packet::setPayloadSize(qint64 payloadSize) { bool Packet::reset() { if (isWritable()) { - setPayloadSize(0); + _payloadSize = 0; } return QIODevice::reset(); From 725383e43a98951c4ed570a0916ca4423d4d0b16 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Wed, 15 Jul 2015 15:30:54 -0700 Subject: [PATCH 3/3] Check ptr, not addr --- libraries/networking/src/LimitedNodeList.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index b57ea3081a..072286b9ab 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -496,7 +496,7 @@ unsigned int LimitedNodeList::broadcastToNodes(std::unique_ptr packet, unsigned int n = 0; eachNode([&](const SharedNodePointer& node){ - if (!node->getActiveSocket()->isNull() && destinationNodeTypes.contains(node->getType())) { + if (node->getActiveSocket() && destinationNodeTypes.contains(node->getType())) { writePacket(*packet, *node->getActiveSocket(), node->getConnectionSecret()); ++n; }