Browse Source

Fixed crash when quitting juci in the middle of starting debug

merge-requests/365/head
eidheim 10 years ago
parent
commit
19734953c2
  1. 1
      src/debug.cc
  2. 8
      src/window.cc
  3. 1
      src/window.h

1
src/debug.cc

@ -258,7 +258,6 @@ void Debug::delete_debug() {
kill(); kill();
if(debug_thread.joinable()) if(debug_thread.joinable())
debug_thread.join(); debug_thread.join();
lldb::SBDebugger::Terminate();
} }
std::string Debug::get_value(const std::string &variable, const boost::filesystem::path &file_path, unsigned int line_nr) { std::string Debug::get_value(const std::string &variable, const boost::filesystem::path &file_path, unsigned int line_nr) {

8
src/window.cc

@ -627,7 +627,7 @@ void Window::set_menu_actions() {
entry_box.labels.emplace_back(); entry_box.labels.emplace_back();
auto label_it=entry_box.labels.begin(); auto label_it=entry_box.labels.begin();
label_it->update=[label_it](int state, const std::string& message){ label_it->update=[label_it](int state, const std::string& message){
label_it->set_text("Leave empty to let juCi++ deduce executable"); label_it->set_text("Set empty to let juCi++ deduce executable");
}; };
label_it->update(0, ""); label_it->update(0, "");
entry_box.entries.emplace_back(run_arguments, [this, project_path](const std::string& content){ entry_box.entries.emplace_back(run_arguments, [this, project_path](const std::string& content){
@ -793,7 +793,7 @@ void Window::set_menu_actions() {
entry_box.labels.emplace_back(); entry_box.labels.emplace_back();
auto label_it=entry_box.labels.begin(); auto label_it=entry_box.labels.begin();
label_it->update=[label_it](int state, const std::string& message){ label_it->update=[label_it](int state, const std::string& message){
label_it->set_text("Leave empty to let juCi++ deduce executable"); label_it->set_text("Set empty to let juCi++ deduce executable");
}; };
label_it->update(0, ""); label_it->update(0, "");
entry_box.entries.emplace_back(run_arguments, [this, project_path](const std::string& content){ entry_box.entries.emplace_back(run_arguments, [this, project_path](const std::string& content){
@ -868,6 +868,7 @@ void Window::set_menu_actions() {
if(exit_status!=EXIT_SUCCESS) if(exit_status!=EXIT_SUCCESS)
debugging=false; debugging=false;
else { else {
debug_start_mutex.lock();
Debug::get().start(command, debug_build_path, breakpoints, [this, command](int exit_status){ Debug::get().start(command, debug_build_path, breakpoints, [this, command](int exit_status){
debugging=false; debugging=false;
Terminal::get().async_print(command+" returned: "+std::to_string(exit_status)+'\n'); Terminal::get().async_print(command+" returned: "+std::to_string(exit_status)+'\n');
@ -885,6 +886,7 @@ void Window::set_menu_actions() {
debug_update_stop(); debug_update_stop();
//Remove debug stop source mark //Remove debug stop source mark
}); });
debug_start_mutex.unlock();
} }
}); });
}); });
@ -1069,7 +1071,9 @@ bool Window::on_delete_event(GdkEventAny *event) {
} }
Terminal::get().kill_async_processes(); Terminal::get().kill_async_processes();
#ifdef JUCI_ENABLE_DEBUG #ifdef JUCI_ENABLE_DEBUG
debug_start_mutex.lock();
Debug::get().delete_debug(); Debug::get().delete_debug();
debug_start_mutex.unlock();
#endif #endif
return false; return false;
} }

1
src/window.h

@ -38,6 +38,7 @@ private:
std::atomic<bool> debugging; std::atomic<bool> debugging;
Gtk::Label debug_status_label; Gtk::Label debug_status_label;
std::mutex debug_start_mutex;
std::pair<boost::filesystem::path, std::pair<int, int> > debug_stop; std::pair<boost::filesystem::path, std::pair<int, int> > debug_stop;
boost::filesystem::path debug_last_stop_file_path; boost::filesystem::path debug_last_stop_file_path;
std::mutex debug_stop_mutex; std::mutex debug_stop_mutex;

Loading…
Cancel
Save