Browse Source

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 <[email protected]>
Hiroshi Miura 6 years ago
parent
commit
3c9c121d91
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/vsearchengine.cpp

+ 8 - 2
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<VSearchConfig> &p_config,