Fix Windows stack overflow problem in the simulate app.

PiperOrigin-RevId: 507763611
Change-Id: I199910142d9165710c48b41a842ab9aef01ff5c2
This commit is contained in:
Saran Tunyasuvunakool
2023-02-07 06:33:12 -08:00
committed by Copybara-Service
parent dd632b7ccc
commit 95a07e85cc
+4 -3
View File
@@ -469,7 +469,8 @@ 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) {
@@ -477,10 +478,10 @@ int main(int argc, const char** argv) {
}
// 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;