Skip to content

Commit

Permalink
Fix Windows stack overflow problem in the simulate app.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 507763611
Change-Id: I199910142d9165710c48b41a842ab9aef01ff5c2
  • Loading branch information
saran-t authored and copybara-github committed Feb 7, 2023
1 parent dd632b7 commit 95a07e8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions simulate/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -469,18 +469,19 @@ int main(int argc, const char** argv) {
scanPluginLibraries();

// simulate object encapsulates the UI
mj::Simulate sim(std::make_unique<mj::GlfwAdapter>());
auto sim = std::make_unique<mj::Simulate>(
std::make_unique<mj::GlfwAdapter>());

const char* filename = nullptr;
if (argc > 1) {
filename = argv[1];
}

// start physics thread
std::thread physicsthreadhandle = std::thread(&PhysicsThread, &sim, filename);
std::thread physicsthreadhandle(&PhysicsThread, sim.get(), filename);

// start simulation UI loop (blocking call)
sim.renderloop();
sim->renderloop();
physicsthreadhandle.join();

return 0;
Expand Down

0 comments on commit 95a07e8

Please sign in to comment.