diff --git a/src/schedulable_state_widget.cc b/src/schedulable_state_widget.cc index 0f35e34..a73384c 100644 --- a/src/schedulable_state_widget.cc +++ b/src/schedulable_state_widget.cc @@ -22,6 +22,8 @@ #include "schedulable_state_widget.hh" +#include "smartp.tcc" + #include #include @@ -29,15 +31,16 @@ using namespace sgpem; -Gtk::Tooltips* -SchedulableStateWidget::_ttips = NULL; +memory::smart_ptr +SchedulableStateWidget::_global_ttips = NULL; SchedulableStateWidget::SchedulableStateWidget(Schedulable::state st) : Glib::ObjectBase("sgpem_SchedulableStateWidget"), CairoWidget(), _color(1, 1, 1) { // Yes, we leak, but this will be up until the end of the app - if(!_ttips) _ttips = new Gtk::Tooltips(); + if(!_global_ttips) _global_ttips = new Gtk::Tooltips(); + _ttips = _global_ttips; set_scaling_mode(scaling_to_w); set_state(st); @@ -46,6 +49,9 @@ SchedulableStateWidget::SchedulableStateWidget(Schedulable::state st) SchedulableStateWidget::~SchedulableStateWidget() { _ttips->unset_tip(*this); + _ttips = memory::smart_ptr::null; + if(_global_ttips.alive_refs() == 1) + _global_ttips = memory::smart_ptr::null; } @@ -68,7 +74,7 @@ SchedulableStateWidget::set_state(Schedulable::state new_state) tip = _("Running"); break; case Schedulable::state_blocked: - _color = Color(0, 0, 1); // Blue + _color = Color(1, 0, 0); // Red tip = _("Blocked"); break; case Schedulable::state_terminated: diff --git a/src/schedulable_state_widget.hh b/src/schedulable_state_widget.hh index b658a1d..3e4dcdb 100644 --- a/src/schedulable_state_widget.hh +++ b/src/schedulable_state_widget.hh @@ -27,7 +27,8 @@ #include "cairo_elements.hh" #include "cairo_widget.hh" -#include "glibmm/refptr.h" +#include "smartp.tcc" + #include "gtkmm/tooltips.h" namespace sgpem @@ -50,8 +51,10 @@ namespace sgpem virtual void calc_widget_size(size_t& width, size_t& height) const; private: - Color _color; - static Gtk::Tooltips* _ttips; + static memory::smart_ptr _global_ttips; + + Color _color; + memory::smart_ptr _ttips; }; } //~ namespace sgpem