History

Fix for potential crash due to DebugDraw data race.

(cherry picked from commit 1b8a624edb81e8f62e2cb257b74e588653daaab2)

Anthony J. Thibault committed 9 years ago

Commit d38b9941 parent efc7fba1 file · +4 −3Browse files

Showing the changes to libraries/render-utils/src/AnimDebugDraw.cpp (1 of 1 file). Show all

Unified · Split

libraries/render-utils/src/AnimDebugDraw.cpp+4−3
@@ -346,7 +346,9 @@ void AnimDebugDraw::update() { · 345 unmodified lines
346346 numVerts += (int)markerMap.size() * VERTICES_PER_BONE;
347347 auto myAvatarMarkerMap = DebugDraw::getInstance().getMyAvatarMarkerMap();
348348 numVerts += (int)myAvatarMarkerMap.size() * VERTICES_PER_BONE;
349− numVerts += (int)DebugDraw::getInstance().getRays().size() * VERTICES_PER_RAY;
349+ auto rays = DebugDraw::getInstance().getRays();
350+ DebugDraw::getInstance().clearRays();
351+ numVerts += (int)rays.size() * VERTICES_PER_RAY;
350352
351353 // allocate verts!
352354 std::vector<AnimDebugDrawData::Vertex> vertices;
@@ -398,10 +400,9 @@ void AnimDebugDraw::update() { · 45 unmodified lines
398400 }
399401
400402 // draw rays from shared DebugDraw singleton
401− for (auto& iter : DebugDraw::getInstance().getRays()) {
403+ for (auto& iter : rays) {
402404 addLine(std::get<0>(iter), std::get<1>(iter), std::get<2>(iter), v);
403405 }
404− DebugDraw::getInstance().clearRays();
405406
406407 data._vertexBuffer->resize(sizeof(AnimDebugDrawData::Vertex) * numVerts);
407408 data._vertexBuffer->setSubData<AnimDebugDrawData::Vertex>(0, vertices);

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