History

Fix JurisdictionMap multithreading issues

Make octal code pointers use shared_ptr, add locks around access.

Ryan Huffman committed 10 years ago

Commit ef6d7581 parent 34e574c9 files · +136 −214Browse files

Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all

Unified · Split

interface/src/Application.cpp+7−7
@@ -3656,11 +3656,11 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 3655 unmodified lines
36563656 } else {
36573657 const JurisdictionMap& map = (jurisdictions)[nodeUUID];
36583658
3659− unsigned char* rootCode = map.getRootOctalCode();
3659+ auto rootCode = map.getRootOctalCode();
36603660
36613661 if (rootCode) {
36623662 VoxelPositionSize rootDetails;
3663− voxelDetailsForCode(rootCode, rootDetails);
3663+ voxelDetailsForCode(rootCode.get(), rootDetails);
36643664 AACube serverBounds(glm::vec3(rootDetails.x * TREE_SCALE,
36653665 rootDetails.y * TREE_SCALE,
36663666 rootDetails.z * TREE_SCALE) - glm::vec3(HALF_TREE_SCALE),
@@ -3720,11 +3720,11 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 53 unmodified lines
37203720 } else {
37213721 const JurisdictionMap& map = (jurisdictions)[nodeUUID];
37223722
3723− unsigned char* rootCode = map.getRootOctalCode();
3723+ auto rootCode = map.getRootOctalCode();
37243724
37253725 if (rootCode) {
37263726 VoxelPositionSize rootDetails;
3727− voxelDetailsForCode(rootCode, rootDetails);
3727+ voxelDetailsForCode(rootCode.get(), rootDetails);
37283728 AACube serverBounds(glm::vec3(rootDetails.x * TREE_SCALE,
37293729 rootDetails.y * TREE_SCALE,
37303730 rootDetails.z * TREE_SCALE) - glm::vec3(HALF_TREE_SCALE),
@@ -4251,9 +4251,9 @@ void Application::nodeKilled(SharedNodePointer node) { · 520 unmodified lines
42514251 return;
42524252 }
42534253
4254− unsigned char* rootCode = _entityServerJurisdictions[nodeUUID].getRootOctalCode();
4254+ auto rootCode = _entityServerJurisdictions[nodeUUID].getRootOctalCode();
42554255 VoxelPositionSize rootDetails;
4256− voxelDetailsForCode(rootCode, rootDetails);
4256+ voxelDetailsForCode(rootCode.get(), rootDetails);
42574257
42584258 qCDebug(interfaceapp, "model server going away...... v[%f, %f, %f, %f]",
42594259 (double)rootDetails.x, (double)rootDetails.y, (double)rootDetails.z, (double)rootDetails.s);
@@ -4378,7 +4378,7 @@ int Application::processOctreeStats(ReceivedMessage& message, SharedNodePointer · 118 unmodified lines
43784378 }
43794379
43804380 VoxelPositionSize rootDetails;
4381− voxelDetailsForCode(octreeStats.getJurisdictionRoot(), rootDetails);
4381+ voxelDetailsForCode(octreeStats.getJurisdictionRoot().get(), rootDetails);
43824382
43834383 qCDebug(interfaceapp, "stats from new %s server... [%f, %f, %f, %f]",
43844384 qPrintable(serverType),