Fixed crash bug in voxelScriptingInterface

This commit is contained in:
barnold1953 2014-07-17 18:15:34 -07:00
parent 9812381645
commit 592c571fcb
2 changed files with 10 additions and 6 deletions

View file

@ -29,9 +29,7 @@ var cellTypes = [];
cellTypes[0] = { r: 255, g: 0, b: 0 };
cellTypes[1] = { r: 0, g: 255, b: 0 };
cellTypes[2] = { r: 0, g:0, b: 255 };
cellTypes[3] = { r: 255, g: 255, b: 255 };
cellTypes[4] = { r: 255, g: 0, b: 255 };
cellTypes[5] = { r: 0, g: 255, b: 255 };
//Check for free region for AC
var regionMarkerX = -1;
@ -152,11 +150,11 @@ function updateCells() {
} else {
if (currentCells[y][x].type == ((cell.type + 1) % cellTypes.length)) {
nextCells[i][j] = currentCells[y][x];
nextCells[i][j].type = currentCells[y][x].type;
nextCells[i][j].changed = true;
} else {
//indicate no update
nextCells[i][j].changed = true;
nextCells[i][j].changed = false;
}
}
}
@ -192,7 +190,7 @@ function sendNextCells() {
var sentFirstBoard = false;
var UPDATES_PER_SECOND = 3.0;
var UPDATES_PER_SECOND = 6.0;
var frameIndex = 1.0;
var oldFrameIndex = 0;

View file

@ -81,11 +81,17 @@ void VoxelsScriptingInterface::setVoxel(float x, float y, float z, float scale,
DeleteVoxelCommand* deleteCommand = new DeleteVoxelCommand(_tree,
addVoxelDetail,
getVoxelPacketSender());
static QMutex mutex;
mutex.lock();
_undoStack->beginMacro(addCommand->text());
// As QUndoStack automatically executes redo() on push, we don't need to execute the command ourselves.
_undoStack->push(deleteCommand);
_undoStack->push(addCommand);
_undoStack->endMacro();
//Unlock the mutex
mutex.unlock();
} else {
// queue the destructive add
queueVoxelAdd(PacketTypeVoxelSetDestructive, addVoxelDetail);