diff options
author | markt <markt> | 2007-09-08 18:38:30 (GMT) |
---|---|---|
committer | markt <markt> | 2007-09-08 18:38:30 (GMT) |
commit | 16218ae90b2499773d0c49a8c2900f269f5a2974 (patch) | |
tree | b0bff08ecdd983808eeec136700bd27ea16ae03a /src | |
parent | adddf014bd80d5ea7595fc1e8df233a857b8d90f (diff) | |
download | fluxbox-16218ae90b2499773d0c49a8c2900f269f5a2974.zip fluxbox-16218ae90b2499773d0c49a8c2900f269f5a2974.tar.bz2 |
fix crash when changing toolbar visibility with empty toolbar.tools
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/Menu.cc | 2 | ||||
-rw-r--r-- | src/FbTk/MenuItem.cc | 7 | ||||
-rw-r--r-- | src/FbTk/Subject.cc | 2 | ||||
-rw-r--r-- | src/MenuCreator.cc | 2 | ||||
-rw-r--r-- | src/Remember.cc | 2 | ||||
-rw-r--r-- | src/Toolbar.cc | 2 |
6 files changed, 10 insertions, 7 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 | ||
507 | void Menu::show() { | 507 | void 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 @@ | |||
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, |
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)); |
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc index 8507388..fefb3dc 100644 --- a/src/MenuCreator.cc +++ b/src/MenuCreator.cc | |||
@@ -325,7 +325,7 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem, FbTk::StringConve | |||
325 | if (submenu == 0) | 325 | if (submenu == 0) |
326 | return; | 326 | return; |
327 | 327 | ||
328 | if (str_cmd.size()) | 328 | if (!str_cmd.empty()) |
329 | submenu->setLabel(str_cmd); | 329 | submenu->setLabel(str_cmd); |
330 | else | 330 | else |
331 | submenu->setLabel(str_label); | 331 | submenu->setLabel(str_label); |
diff --git a/src/Remember.cc b/src/Remember.cc index 2de6d86..f5a5ac8 100644 --- a/src/Remember.cc +++ b/src/Remember.cc | |||
@@ -387,7 +387,7 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) { | |||
387 | 387 | ||
388 | bool had_error = false; | 388 | bool had_error = false; |
389 | 389 | ||
390 | if (!str_key.size()) | 390 | if (str_key.empty()) |
391 | continue; //read next line | 391 | continue; //read next line |
392 | if (strcasecmp(str_key.c_str(), "Workspace") == 0) { | 392 | if (strcasecmp(str_key.c_str(), "Workspace") == 0) { |
393 | unsigned int w; | 393 | unsigned int w; |
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index ad1a8e5..b5ad967 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -412,7 +412,7 @@ void Toolbar::reconfigure() { | |||
412 | 412 | ||
413 | m_tools = tools; // copy values | 413 | m_tools = tools; // copy values |
414 | 414 | ||
415 | if (m_tools.size()) { | 415 | if (!m_tools.empty()) { |
416 | // make lower case | 416 | // make lower case |
417 | transform(m_tools.begin(), m_tools.end(), | 417 | transform(m_tools.begin(), m_tools.end(), |
418 | m_tools.begin(), | 418 | m_tools.begin(), |