diff options
Diffstat (limited to 'src/FbTk/MenuItem.cc')
-rw-r--r-- | src/FbTk/MenuItem.cc | 7 |
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 @@ | |||
34 | namespace FbTk { | 34 | namespace FbTk { |
35 | 35 | ||
36 | void MenuItem::click(int button, int time) { | 36 | void 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 | ||
41 | void MenuItem::drawLine(FbDrawable &draw, const MenuTheme &theme, size_t size, | 44 | void MenuItem::drawLine(FbDrawable &draw, const MenuTheme &theme, size_t size, |