History

Fix for metavoxel crashes on Windows. I was expecting the scope of a temporary object to last until the next line; turns out VC++ can destroy it in the middle of evaluating the line.

Andrzej Kapolka committed 12 years ago

Commit 72ff9081 parent 9855fbc1 file · +10 −5Browse files

Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 1 file). Show all

Unified · Split

interface/src/MetavoxelSystem.cpp+10−5
@@ -1204,7 +1204,8 @@ int PointAugmentVisitor::visit(MetavoxelInfo& info) { · 1203 unmodified lines
12041204 _points.swap(swapPoints);
12051205 buffer = new PointBuffer(swapPoints);
12061206 }
1207− info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer)));
1207+ BufferDataPointer pointer(buffer);
1208+ info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
12081209 }
12091210 return STOP_RECURSION;
12101211 }
@@ -1219,7 +1220,8 @@ bool PointAugmentVisitor::postVisit(MetavoxelInfo& info) { · 8 unmodified lines
12191220 _points.swap(swapPoints);
12201221 buffer = new PointBuffer(swapPoints);
12211222 }
1222− info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer)));
1223+ BufferDataPointer pointer(buffer);
1224+ info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
12231225 return true;
12241226 }
12251227
@@ -1446,7 +1448,8 @@ int HeightfieldRegionVisitor::visit(MetavoxelInfo& info) { · 220 unmodified lines
14461448 _data->guide(_fetchVisitor);
14471449 }
14481450 }
1449− info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer)));
1451+ BufferDataPointer pointer(buffer);
1452+ info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
14501453 return STOP_RECURSION;
14511454 }
14521455
@@ -1505,7 +1508,8 @@ int HeightfieldUpdateVisitor::visit(MetavoxelInfo& info) { · 52 unmodified lines
15051508 buffer->getHeight(), buffer->getColor(), buffer->getMaterial(), buffer->getMaterials());
15061509 _fetchVisitor.init(newBuffer);
15071510 _data->guide(_fetchVisitor);
1508− info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(newBuffer)));
1511+ BufferDataPointer pointer(newBuffer);
1512+ info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
15091513 return STOP_RECURSION;
15101514 }
15111515
@@ -2078,7 +2082,8 @@ int VoxelAugmentVisitor::visit(MetavoxelInfo& info) { · 566 unmodified lines
20782082
20792083 buffer = new VoxelBuffer(vertices, indices, material->getMaterials());
20802084 }
2081− info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(BufferDataPointer(buffer)));
2085+ BufferDataPointer pointer(buffer);
2086+ info.outputValues[0] = AttributeValue(_outputs.at(0), encodeInline(pointer));
20822087 return STOP_RECURSION;
20832088 }
20842089