History

fix crashing on deleting voxels in server and client

ZappoMan committed 13 years ago

Commit 06f25281 parent dfe70085 files · +51 −29Browse files

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

Unified · Split

interface/src/VoxelSystem.cpp+1−2
@@ -337,16 +337,15 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) { · 336 unmodified lines
337 } else {337 } else {
338 voxelsUpdated += updateNodeInArraysAsPartialVBO(node);338 voxelsUpdated += updateNodeInArraysAsPartialVBO(node);
339 }339 }
340 node->clearDirtyBit(); // clear the dirty bit, do this before we potentially delete things.
340 341
341 // If the node has been asked to be deleted, but we've gotten to here, after updateNodeInArraysXXX()342 // If the node has been asked to be deleted, but we've gotten to here, after updateNodeInArraysXXX()
342 // then it means our VBOs are "clean" and our vertices have been removed or not added. So we can now343 // then it means our VBOs are "clean" and our vertices have been removed or not added. So we can now
343 // safely remove the node from the tree and actually delete it.344 // safely remove the node from the tree and actually delete it.
344 // otherwise honor our calculated shouldRender
345 if (node->isStagedForDeletion()) {345 if (node->isStagedForDeletion()) {
346 _tree->deleteVoxelCodeFromTree(node->getOctalCode());346 _tree->deleteVoxelCodeFromTree(node->getOctalCode());
347 }347 }
348 348
349 node->clearDirtyBit(); // always clear the dirty bit, even if it doesn't need to be rendered
350 return voxelsUpdated;349 return voxelsUpdated;
351}350}
352 351

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t