Browse Source

Fixed a crash when tab was closed before the parsing was done. Juci sometimes crashes when quitting, maybe while parsing for the first time. Will look into it.

merge-requests/365/head
eidheim 11 years ago
parent
commit
5c21533435
  1. 7
      juci/source.cc
  2. 1
      juci/source.h

7
juci/source.cc

@ -163,13 +163,14 @@ parse_thread_go(true), parse_thread_mapped(false), parse_thread_stop(false) {
parse_thread_go=true;
});
auto first_time_parse_done=this->terminal.PrintMessage("Parsing "+file_path, "finished");
parse_done.connect([this, first_time_parse_done](){
first_time_parse_done=this->terminal.PrintMessage("Parsing "+file_path, "finished");
parse_done.connect([this](){
if(parse_thread_mapped) {
INFO("Updating syntax");
update_syntax(extract_tokens(0, get_source_buffer()->get_text().size()));
if(first_time_parse) {
first_time_parse_done();
first_time_parse_done=[](){};
first_time_parse=false;
}
INFO("Syntax updated");
@ -214,6 +215,8 @@ Source::ClangView::~ClangView() {
parse_thread.join();
parsing_mutex.lock(); //Be sure not to destroy while still parsing with libclang
parsing_mutex.unlock();
if(first_time_parse)
first_time_parse_done(); //This function must be run if it is not run already
}
void Source::ClangView::

1
juci/source.h

@ -110,6 +110,7 @@ namespace Source {
bool on_key_release(GdkEventKey* key);
Terminal::Controller& terminal;
bool first_time_parse=true;
std::function<void()> first_time_parse_done;
Glib::Dispatcher parse_done;
Glib::Dispatcher parse_start;

Loading…
Cancel
Save