From 2ff85a5a60f274d16b7ea8880b46536b2bd16e2d Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Sat, 16 Feb 2013 12:07:20 -0800 Subject: [PATCH] Only joining threads if they are created --- cpp/ycm/ClangCompleter/ClangCompleter.cpp | 6 ++++-- cpp/ycm/IdentifierCompleter.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cpp/ycm/ClangCompleter/ClangCompleter.cpp b/cpp/ycm/ClangCompleter/ClangCompleter.cpp index b50801c6..d1fda853 100644 --- a/cpp/ycm/ClangCompleter/ClangCompleter.cpp +++ b/cpp/ycm/ClangCompleter/ClangCompleter.cpp @@ -101,8 +101,10 @@ ClangCompleter::~ClangCompleter() { sorting_threads_.interrupt_all(); sorting_threads_.join_all(); - clang_thread_->interrupt(); - clang_thread_->join(); + if ( clang_thread_ ) { + clang_thread_->interrupt(); + clang_thread_->join(); + } } diff --git a/cpp/ycm/IdentifierCompleter.cpp b/cpp/ycm/IdentifierCompleter.cpp index ec7c62e3..8f3b2c21 100644 --- a/cpp/ycm/IdentifierCompleter.cpp +++ b/cpp/ycm/IdentifierCompleter.cpp @@ -103,8 +103,10 @@ IdentifierCompleter::~IdentifierCompleter() { query_threads_.interrupt_all(); query_threads_.join_all(); - buffer_identifiers_thread_->interrupt(); - buffer_identifiers_thread_->join(); + if ( buffer_identifiers_thread_ ) { + buffer_identifiers_thread_->interrupt(); + buffer_identifiers_thread_->join(); + } }