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 f10f1b7..23efcfe 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -502,7 +502,7 @@ void Menu::updateMenu(int active_index) {
502 502
503void Menu::show() { 503void Menu::show() {
504 504
505 if (isVisible() || !menuitems.size()) 505 if (isVisible() || menuitems.empty())
506 return; 506 return;
507 507
508 m_visible = true; 508 m_visible = true;
diff --git a/src/FbTk/MenuItem.cc b/src/FbTk/MenuItem.cc
index b598c47..2576d2b 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));