Browse Source

Language client: fixed crash when renaming file: no longer attempts to reuse shutdown thread pool

pipelines/235045657
eidheim 5 years ago
parent
commit
a76968da11
  1. 8
      src/source_language_protocol.cpp
  2. 1
      src/source_language_protocol.hpp

8
src/source_language_protocol.cpp

@ -377,7 +377,7 @@ void Source::LanguageProtocolView::initialize() {
update_status_state(this);
set_editable(false);
thread_pool.push([this] {
initialize_thread = std::thread([this] {
auto capabilities = client->initialize(this);
dispatcher.post([this, capabilities] {
@ -412,14 +412,15 @@ void Source::LanguageProtocolView::close() {
autocomplete_delayed_show_arguments_connection.disconnect();
update_type_coverage_connection.disconnect();
if(initialize_thread.joinable())
initialize_thread.join();
if(autocomplete) {
autocomplete->state = Autocomplete::State::idle;
if(autocomplete->thread.joinable())
autocomplete->thread.join();
}
thread_pool.shutdown(true);
client->write_notification("textDocument/didClose", R"("textDocument":{"uri":")" + uri + "\"}");
client->close(this);
client = nullptr;
@ -427,6 +428,7 @@ void Source::LanguageProtocolView::close() {
Source::LanguageProtocolView::~LanguageProtocolView() {
close();
thread_pool.shutdown(true);
}
void Source::LanguageProtocolView::rename(const boost::filesystem::path &path) {

1
src/source_language_protocol.hpp

@ -183,6 +183,7 @@ namespace Source {
size_t document_version = 1;
std::thread initialize_thread;
Dispatcher dispatcher;
Glib::ThreadPool thread_pool;

Loading…
Cancel
Save