Browse Source

Fixed a crash when reading from deleted clang_tokens. Also fixed a scrolling issue.

merge-requests/365/head
eidheim 11 years ago
parent
commit
2d38d6499e
  1. 2
      juci/notebook.cc
  2. 11
      juci/source.cc
  3. 1
      juci/source.h

2
juci/notebook.cc

@ -94,6 +94,8 @@ void Notebook::Controller::CreateKeybindings() {
if(location.first.size()>0) { if(location.first.size()>0) {
open_file(location.first); open_file(location.first);
CurrentSourceView()->get_buffer()->place_cursor(CurrentSourceView()->get_buffer()->get_iter_at_offset(location.second)); CurrentSourceView()->get_buffer()->place_cursor(CurrentSourceView()->get_buffer()->get_iter_at_offset(location.second));
while(gtk_events_pending())
gtk_main_iteration();
CurrentSourceView()->scroll_to(CurrentSourceView()->get_buffer()->get_insert(), 0.0, 1.0, 0.5); CurrentSourceView()->scroll_to(CurrentSourceView()->get_buffer()->get_insert(), 0.0, 1.0, 0.5);
} }
} }

11
juci/source.cc

@ -48,16 +48,6 @@ file_path(file_path), project_path(project_path) {
} }
get_buffer()->place_cursor(get_buffer()->get_iter_at_offset(0)); get_buffer()->place_cursor(get_buffer()->get_iter_at_offset(0));
signal_size_allocate().connect([this](Gtk::Allocation& allocation){
if(!after_user_input)
scroll_to(get_buffer()->get_insert(), 0.0, 1.0, 0.5);
});
signal_event().connect([this](GdkEvent* event){
if(event->type==GDK_KEY_PRESS || event->type==GDK_BUTTON_PRESS || event->type==GDK_SCROLL)
after_user_input=true;
return false;
});
search_settings = gtk_source_search_settings_new(); search_settings = gtk_source_search_settings_new();
gtk_source_search_settings_set_wrap_around(search_settings, true); gtk_source_search_settings_set_wrap_around(search_settings, true);
@ -380,6 +370,7 @@ void Source::ClangViewParse::start_reparse() {
clang_readable=false; clang_readable=false;
delayed_reparse_connection.disconnect(); delayed_reparse_connection.disconnect();
delayed_reparse_connection=Glib::signal_timeout().connect([this]() { delayed_reparse_connection=Glib::signal_timeout().connect([this]() {
clang_readable=false;
parse_thread_go=true; parse_thread_go=true;
return false; return false;
}, 1000); }, 1000);

1
juci/source.h

@ -66,7 +66,6 @@ public:
std::function<std::pair<std::string, unsigned>()> get_declaration_location; std::function<std::pair<std::string, unsigned>()> get_declaration_location;
std::function<void()> goto_method; std::function<void()> goto_method;
bool after_user_input=false;
protected: protected:
bool on_key_press_event(GdkEventKey* key); bool on_key_press_event(GdkEventKey* key);
private: private:

Loading…
Cancel
Save