diff --git a/src/project.cc b/src/project.cc index a28352f..d718951 100644 --- a/src/project.cc +++ b/src/project.cc @@ -15,11 +15,10 @@ std::atomic Project::compiling; std::atomic Project::debugging; std::pair > Project::debug_stop; boost::filesystem::path Project::debug_last_stop_file_path; -std::unique_ptr Project::debug_status_label; void Project::debug_update_status(const std::string &debug_status) { if(debug_status.empty()) { - debug_status_label->set_text(""); + debug_status_label().set_text(""); auto &menu=Menu::get(); menu.actions["debug_stop"]->set_enabled(false); menu.actions["debug_kill"]->set_enabled(false); @@ -32,7 +31,7 @@ void Project::debug_update_status(const std::string &debug_status) { menu.actions["debug_goto_stop"]->set_enabled(false); } else { - debug_status_label->set_text("debug: "+debug_status); + debug_status_label().set_text("debug: "+debug_status); auto &menu=Menu::get(); menu.actions["debug_stop"]->set_enabled(); menu.actions["debug_kill"]->set_enabled(); @@ -279,7 +278,7 @@ void Project::Clang::debug_start() { dispatcher.add([this, status] { debug_update_status(status); }); - }, [this](const boost::filesystem::path &file_path, int line_nr, int line_index) { + }, [this](const boost::filesystem::path &file_path, int line_nr, int line_index) { dispatcher.add([this, file_path, line_nr, line_index] { Project::debug_stop.first=file_path; Project::debug_stop.second.first=line_nr; diff --git a/src/project.h b/src/project.h index 02476bb..d255bee 100644 --- a/src/project.h +++ b/src/project.h @@ -21,9 +21,13 @@ public: static std::atomic debugging; static std::pair > debug_stop; static void debug_update_stop(); - static std::unique_ptr debug_status_label; static void debug_update_status(const std::string &debug_status); + static Gtk::Label &debug_status_label() { + static Gtk::Label label; + return label; + } + class Language { public: Language() {} diff --git a/src/window.cc b/src/window.cc index c9ced70..78ac55b 100644 --- a/src/window.cc +++ b/src/window.cc @@ -26,8 +26,6 @@ Window::Window() : notebook(Notebook::get()) { set_title("juCi++"); set_events(Gdk::POINTER_MOTION_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::SCROLL_MASK|Gdk::LEAVE_NOTIFY_MASK); - Project::debug_status_label=std::unique_ptr(new Gtk::Label()); - set_menu_actions(); configure(); @@ -52,10 +50,10 @@ Window::Window() : notebook(Notebook::get()) { info_and_status_hbox.pack_start(notebook.info, Gtk::PACK_SHRINK); #if GTK_VERSION_GE(3, 12) - info_and_status_hbox.set_center_widget(*Project::debug_status_label); + info_and_status_hbox.set_center_widget(Project::debug_status_label()); #else - Project::debug_status_label->set_halign(Gtk::Align::ALIGN_CENTER); - info_and_status_hbox.pack_start(*Project::debug_status_label); + Project::debug_status_label().set_halign(Gtk::Align::ALIGN_CENTER); + info_and_status_hbox.pack_start(Project::debug_status_label()); #endif info_and_status_hbox.pack_end(notebook.status, Gtk::PACK_SHRINK); terminal_vbox.pack_end(info_and_status_hbox, Gtk::PACK_SHRINK);