Avoid msan reports on globals destructors
Somehow tests load these libs twice, and construct/destruct globals twice. Can be preproduced even without sanitizers with logging from GlobalModel::~GlobalModel. themodel does not need to be visible. If it's static each instance will have own a copy. _mjMap does not need to use string and avoid lifecycle issues at all. PiperOrigin-RevId: 454678814 Change-Id: I8fca5e1f06cbc2b413beabcece1219445482c0ed
This commit is contained in:
committed by
Copybara-Service
parent
ec7133b0d3
commit
8dda269c8a
+2
-3
@@ -62,9 +62,8 @@ void GlobalModel::Clear() {
|
||||
|
||||
|
||||
// single instance of global model, protected with mutex
|
||||
GlobalModel themodel;
|
||||
std::mutex themutex;
|
||||
|
||||
static GlobalModel themodel;
|
||||
static std::mutex themutex;
|
||||
|
||||
//---------------------------------- Functions -----------------------------------------------------
|
||||
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ class mjXSchema {
|
||||
|
||||
// key(string) : value(int) map
|
||||
struct _mjMap {
|
||||
std::string key;
|
||||
const char* key;
|
||||
int value;
|
||||
};
|
||||
typedef struct _mjMap mjMap;
|
||||
|
||||
Reference in New Issue
Block a user