From 09bd8f26cb37b58310ce16bf7b8b6003b4244ed5 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 29 Oct 2018 16:06:11 +0100 Subject: Some fixes for issues seen with cppcheck --- src/RemoteControl.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/RemoteControl.h') diff --git a/src/RemoteControl.h b/src/RemoteControl.h index b133a8f..7fc8e04 100644 --- a/src/RemoteControl.h +++ b/src/RemoteControl.h @@ -210,7 +210,9 @@ class RemoteControllerTelnet : public BaseRemoteController { m_fault(false), m_port(port) { - restart(); + // Don't call virtual functions from the ctor + // https://isocpp.org/wiki/faq/strange-inheritance#calling-virtuals-from-ctors + internal_restart(); } @@ -221,9 +223,10 @@ class RemoteControllerTelnet : public BaseRemoteController { virtual bool fault_detected() { return m_fault; } - virtual void restart(); + virtual void restart() { internal_restart(); } private: + void internal_restart(); void restart_thread(long); void process(long); -- cgit v1.2.3