From 90dc16bb9900b31b77d1ff24751d674669aa7e70 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Sat, 16 Feb 2013 12:24:00 -0800 Subject: [PATCH] Destroying clang data last, after threads done Otherwise this will cause issues if the clang threads are still trying to access the clang data. --- cpp/ycm/ClangCompleter/ClangCompleter.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cpp/ycm/ClangCompleter/ClangCompleter.cpp b/cpp/ycm/ClangCompleter/ClangCompleter.cpp index d1fda853..dfdf3882 100644 --- a/cpp/ycm/ClangCompleter/ClangCompleter.cpp +++ b/cpp/ycm/ClangCompleter/ClangCompleter.cpp @@ -88,11 +88,6 @@ ClangCompleter::ClangCompleter() ClangCompleter::~ClangCompleter() { - // We need to clear this before calling clang_disposeIndex because the - // translation units need to be destroyed before the index is destroyed. - filename_to_translation_unit_.clear(); - clang_disposeIndex( clang_index_ ); - { unique_lock< shared_mutex > lock( time_to_die_mutex_ ); time_to_die_ = true; @@ -105,6 +100,11 @@ ClangCompleter::~ClangCompleter() { clang_thread_->interrupt(); clang_thread_->join(); } + + // We need to clear this before calling clang_disposeIndex because the + // translation units need to be destroyed before the index is destroyed. + filename_to_translation_unit_.clear(); + clang_disposeIndex( clang_index_ ); }