mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 16:23:34 +08:00
Good old GDTR singleton re-implemented via static local again, because previous implementation could cause undefined behavior as GDTR could be initialized after static type registrators that use it
This commit is contained in:
@@ -10,8 +10,6 @@
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
GlobalDataTypeRegistry GlobalDataTypeRegistry::singleton;
|
||||
|
||||
GlobalDataTypeRegistry::List* GlobalDataTypeRegistry::selectList(DataTypeKind kind) const
|
||||
{
|
||||
if (kind == DataTypeKindMessage)
|
||||
@@ -129,6 +127,7 @@ GlobalDataTypeRegistry::RegistResult GlobalDataTypeRegistry::registImpl(Entry* d
|
||||
|
||||
GlobalDataTypeRegistry& GlobalDataTypeRegistry::instance()
|
||||
{
|
||||
static GlobalDataTypeRegistry singleton;
|
||||
return singleton;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user