From dd489a0797310dec2ae893d225bfdf0af861d9fa Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Dec 2017 12:06:14 +1100 Subject: [PATCH] AP_SerialManager: removed create() method for objects See discussion here: https://github.com/ArduPilot/ardupilot/issues/7331 we were getting some uninitialised variables. While it only showed up in AP_SbusOut, it means we can't be sure it won't happen on other objects, so safest to remove the approach Thanks to assistance from Lucas, Peter and Francisco --- libraries/AP_SerialManager/AP_SerialManager.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/libraries/AP_SerialManager/AP_SerialManager.h b/libraries/AP_SerialManager/AP_SerialManager.h index 8c9d34fdef..bff0d62251 100644 --- a/libraries/AP_SerialManager/AP_SerialManager.h +++ b/libraries/AP_SerialManager/AP_SerialManager.h @@ -81,6 +81,12 @@ class AP_SerialManager { public: + AP_SerialManager(); + + /* Do not allow copies */ + AP_SerialManager(const AP_SerialManager &other) = delete; + AP_SerialManager &operator=(const AP_SerialManager&) = delete; + enum SerialProtocol { SerialProtocol_None = -1, SerialProtocol_Console = 0, // unused @@ -106,14 +112,6 @@ public: return _instance; } - static AP_SerialManager create() { return AP_SerialManager{}; } - - constexpr AP_SerialManager(AP_SerialManager &&other) = default; - - /* Do not allow copies */ - AP_SerialManager(const AP_SerialManager &other) = delete; - AP_SerialManager &operator=(const AP_SerialManager&) = delete; - // init_console - initialise console at default baud rate void init_console(); @@ -149,8 +147,6 @@ public: static const struct AP_Param::GroupInfo var_info[]; private: - AP_SerialManager(); - static AP_SerialManager *_instance; // array of uart info