Fix a segfault in the passive viewer on macOS.

The segfault is caused by a call to mjui_update outside of the macOS main thread, introduced in 3e12f0d50c.

PiperOrigin-RevId: 572531447
Change-Id: Ib8424c746d18a776c0b91087d9501aa8ee463026
This commit is contained in:
Saran Tunyasuvunakool
2023-10-11 04:05:37 -07:00
committed by Copybara-Service
parent 742f15fb18
commit ba03ebdadd
2 changed files with 9 additions and 1 deletions
+8 -1
View File
@@ -1885,7 +1885,7 @@ void Simulate::Sync() {
update_profiler = true;
update_sensor = true;
scrub_index = 0;
mjui0_update_section(this, SECT_SIMULATION);
pending_.ui_update_simulation = true;
pending_.reset = false;
}
@@ -2326,6 +2326,13 @@ void Simulate::Render() {
}
// update UI sections from last sync
if (pending_.ui_update_simulation) {
if (this->ui0_enable && this->ui0.sect[SECT_SIMULATION].state) {
mjui0_update_section(this, SECT_SIMULATION);
}
pending_.ui_update_simulation = false;
}
if (this->ui0_enable && this->ui0.sect[SECT_WATCH].state) {
mjui0_update_section(this, SECT_WATCH);
}
+1
View File
@@ -148,6 +148,7 @@ class Simulate {
int newperturb;
bool select;
mjuiState select_state;
bool ui_update_simulation;
bool ui_update_physics;
bool ui_update_rendering;
bool ui_update_joint;