From 3c9c121d91dcd61974b09abff75ba2330c874a64 Mon Sep 17 00:00:00 2001 From: Hiroshi Miura Date: Sun, 13 Jan 2019 11:55:20 +0900 Subject: [PATCH] VSearchEngine: avoid virtual func in detor (#570) Clang-tidy checker warns followings. Call to virtual function during destruction [clang-analyzer-optin.cplusplus.VirtualCall] stop(); clear(); note: This destructor of an object of type '~VSearchEngine' has not returned when the virtual method was called Signed-off-by: Hiroshi Miura --- src/vsearchengine.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/vsearchengine.cpp b/src/vsearchengine.cpp index 543ead84..cbd31c25 100644 --- a/src/vsearchengine.cpp +++ b/src/vsearchengine.cpp @@ -151,8 +151,14 @@ VSearchEngine::VSearchEngine(QObject *p_parent) VSearchEngine::~VSearchEngine() { - stop(); - clear(); + for (auto const & th : m_workers) { + th->stop(); + th->quit(); + th->wait(); + delete th; + } + m_workers.clear(); + m_result.clear(); } void VSearchEngine::search(const QSharedPointer &p_config,