aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Menu.cc2
-rw-r--r--src/FbTk/MenuItem.cc7
-rw-r--r--src/FbTk/Subject.cc2
3 files changed, 7 insertions, 4 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index ee17204..b0fcb4b 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -506,7 +506,7 @@ void Menu::updateMenu(int active_index) {
506 506
507void Menu::show() { 507void Menu::show() {
508 508
509 if (isVisible() || !menuitems.size()) 509 if (isVisible() || menuitems.empty())
510 return; 510 return;
511 511
512 m_visible = true; 512 m_visible = true;
diff --git a/src/FbTk/MenuItem.cc b/src/FbTk/MenuItem.cc
index 82dd155..bc80ca0 100644
--- a/src/FbTk/MenuItem.cc
+++ b/src/FbTk/MenuItem.cc
@@ -34,8 +34,11 @@
34namespace FbTk { 34namespace FbTk {
35 35
36void MenuItem::click(int button, int time) { 36void MenuItem::click(int button, int time) {
37 if (m_command.get() != 0) 37 if (m_command.get() != 0) {
38 m_command->execute(); 38 // we need a local variable, since the command may destroy this object
39 RefCount<Command> tmp(m_command);
40 tmp->execute();
41 }
39} 42}
40 43
41void MenuItem::drawLine(FbDrawable &draw, const MenuTheme &theme, size_t size, 44void MenuItem::drawLine(FbDrawable &draw, const MenuTheme &theme, size_t size,
diff --git a/src/FbTk/Subject.cc b/src/FbTk/Subject.cc
index 2b30fd8..08a211c 100644
--- a/src/FbTk/Subject.cc
+++ b/src/FbTk/Subject.cc
@@ -64,7 +64,7 @@ void Subject::notify() {
64 m_notify_mode = false; 64 m_notify_mode = false;
65 65
66 // remove dead observers 66 // remove dead observers
67 if (m_dead_observers.size()) { 67 if (!m_dead_observers.empty()) {
68 std::for_each(m_dead_observers.begin(), 68 std::for_each(m_dead_observers.begin(),
69 m_dead_observers.end(), 69 m_dead_observers.end(),
70 std::bind1st(std::mem_fun(&Subject::detach), this)); 70 std::bind1st(std::mem_fun(&Subject::detach), this));