[Cleanup] Do not call own class functions from constructor/destructor

A constructor or destructor should not call functions of its own class.
Especially not when these classes use inheritance.

Problem is that inside the constructor a class is not yet completely initialized.
Accessing non virtual methods can be done, but you better should not do it as it may lead to subtle bugs when such functions are later changed.
This commit is contained in:
TD-er
2022-11-24 17:05:18 +01:00
parent ff541e1a7c
commit 56e73d5bcd
148 changed files with 698 additions and 466 deletions
+3 -3
View File
@@ -68,9 +68,9 @@ struct P082_data_struct : public PluginTaskData_base {
P082_data_struct();
~P082_data_struct();
virtual ~P082_data_struct();
void reset();
// void reset();
bool init(ESPEasySerialPort port,
const int16_t serial_rx,
@@ -151,7 +151,7 @@ public:
String _currentSentence;
# endif // ifdef P082_SEND_GPS_TO_LOG
float _cache[static_cast<uint8_t>(P082_query::P082_NR_OUTPUT_OPTIONS)] = { 0 };
float _cache[static_cast<uint8_t>(P082_query::P082_NR_OUTPUT_OPTIONS)];
};
#endif // ifdef USES_P082