diff --git a/juci/source.cc b/juci/source.cc index 1943959..ff018e5 100644 --- a/juci/source.cc +++ b/juci/source.cc @@ -286,6 +286,11 @@ Source::Controller::Controller(const Source::Config &config, view().signal_key_press_event().connect(sigc::mem_fun(*this, &Source::Controller::OnKeyPress), false); } +Source::Controller::~Controller() { + parsing.lock(); //Be sure not to destroy while still parsing with libclang + parsing.unlock(); +} + // Source::Controller::view() // return shared_ptr to the view Source::View& Source::Controller::view() { @@ -345,7 +350,9 @@ void Source::Controller::OnOpenFile(const string &filepath) { std::map buffers; notebook_->MapBuffers(&buffers); buffers[filepath] = s.get_content(); + buffer()->get_undo_manager()->begin_not_undoable_action(); buffer()->set_text(s.get_content()); + buffer()->get_undo_manager()->end_not_undoable_action(); int start_offset = buffer()->begin().get_offset(); int end_offset = buffer()->end().get_offset(); if (notebook_->LegalExtension(filepath.substr(filepath.find_last_of(".") + 1))) { diff --git a/juci/source.h b/juci/source.h index c18e525..083fd30 100644 --- a/juci/source.h +++ b/juci/source.h @@ -143,6 +143,7 @@ namespace Source { Controller(const Source::Config &config, Notebook::Controller *notebook); Controller(); + ~Controller(); View& view(); Model& model(); void OnNewEmptyFile();