Do not delete attached specs after compilation.
Also, copy them when copying the spec. PiperOrigin-RevId: 688998464 Change-Id: I7229fd8032eafede582194ccf73ab4160fe06768
This commit is contained in:
committed by
Copybara-Service
parent
e14aebfd16
commit
d17d9e835c
@@ -388,6 +388,9 @@ mjCModel& mjCModel::operator+=(const mjCModel& other) {
|
||||
}
|
||||
CopyList(numerics_, other.numerics_);
|
||||
CopyList(texts_, other.texts_);
|
||||
for (const auto* s : other.specs_) {
|
||||
specs_.push_back(mj_copySpec(s));
|
||||
}
|
||||
}
|
||||
CopyList(flexes_, other.flexes_);
|
||||
CopyList(pairs_, other.pairs_);
|
||||
@@ -3648,12 +3651,6 @@ mjModel* mjCModel::Compile(const mjVFS* vfs, mjModel** m) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// destroy attached specs
|
||||
for (auto spec : specs_) {
|
||||
mj_deleteSpec(spec);
|
||||
}
|
||||
specs_.clear();
|
||||
|
||||
// restore error handler, mark as compiled, return mjModel
|
||||
_mjPRIVATE__set_tls_error_fn(save_error);
|
||||
_mjPRIVATE__set_tls_warning_fn(save_warning);
|
||||
|
||||
Reference in New Issue
Block a user