aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/MenuItem.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/MenuItem.cc')
-rw-r--r--src/FbTk/MenuItem.cc7
1 files changed, 5 insertions, 2 deletions
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,