From b9b51f9579c15c9789814cd4b6969b0f85e13980 Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Fri, 11 Aug 2023 11:58:33 +0200 Subject: Prevent overriding virtual methods that are called in a destructor Virtual methods are no longer valid once the derived destructor has run. This means the compiler is free to optimize them to be non-virtual. Found using clang-tidy --- src/libmain/progress-bar.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libmain') diff --git a/src/libmain/progress-bar.cc b/src/libmain/progress-bar.cc index 6600ec177..45b1fdfd1 100644 --- a/src/libmain/progress-bar.cc +++ b/src/libmain/progress-bar.cc @@ -108,7 +108,8 @@ public: stop(); } - void stop() override + /* Called by destructor, can't be overridden */ + void stop() override final { { auto state(state_.lock()); -- cgit v1.2.3