Destroying clang data last, after threads done

Otherwise this will cause issues if the clang threads are still trying to
access the clang data.
This commit is contained in:
Strahinja Val Markovic 2013-02-16 12:24:00 -08:00
parent f01a3480f5
commit 90dc16bb99

View File

@ -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_ );
}