diff --git a/src/source.cc b/src/source.cc index b3c2075..83f6d37 100644 --- a/src/source.cc +++ b/src/source.cc @@ -1997,7 +1997,7 @@ Source::ClangViewParse(file_path, project_path, language), autocomplete_cancel_s return false; }); - autocomplete_fail.connect([this]() { + autocomplete_fail_connection=autocomplete_fail.connect([this]() { Singleton::terminal()->print("Error: autocomplete failed, reparsing "+this->file_path.string()+"\n"); restart_parse(); autocomplete_starting=false; @@ -2219,6 +2219,8 @@ std::vector Source::ClangViewAu void Source::ClangViewAutocomplete::async_delete() { parsing_in_progress->cancel("canceled, freeing resources in the background"); + autocomplete_done_connection.disconnect(); + autocomplete_fail_connection.disconnect(); parse_thread_stop=true; delete_thread=std::thread([this](){ //TODO: Is it possible to stop the clang-process in progress? diff --git a/src/source.h b/src/source.h index 214da6b..0490e3d 100644 --- a/src/source.h +++ b/src/source.h @@ -282,6 +282,7 @@ namespace Source { Glib::Dispatcher autocomplete_done; sigc::connection autocomplete_done_connection; Glib::Dispatcher autocomplete_fail; + sigc::connection autocomplete_fail_connection; bool autocomplete_starting=false; std::atomic autocomplete_cancel_starting; guint last_keyval=0;