fix crash when changing toolbar visibility with empty toolbar.tools
This commit is contained in:
parent
adddf014bd
commit
16218ae90b
7 changed files with 13 additions and 7 deletions
|
@ -1,5 +1,8 @@
|
|||
(Format: Year/Month/Day)
|
||||
Changes for 1.0.0:
|
||||
*07/09/07:
|
||||
* Fix crash when changing toolbar visibility, #1786765 (Mark)
|
||||
FbTk/MenuItem.cc
|
||||
*07/08/27:
|
||||
* Fix hardcoded Mod1, use ModKey() now (Mathias)
|
||||
Window.cc
|
||||
|
|
|
@ -506,7 +506,7 @@ void Menu::updateMenu(int active_index) {
|
|||
|
||||
void Menu::show() {
|
||||
|
||||
if (isVisible() || !menuitems.size())
|
||||
if (isVisible() || menuitems.empty())
|
||||
return;
|
||||
|
||||
m_visible = true;
|
||||
|
|
|
@ -34,8 +34,11 @@
|
|||
namespace FbTk {
|
||||
|
||||
void MenuItem::click(int button, int time) {
|
||||
if (m_command.get() != 0)
|
||||
m_command->execute();
|
||||
if (m_command.get() != 0) {
|
||||
// we need a local variable, since the command may destroy this object
|
||||
RefCount<Command> tmp(m_command);
|
||||
tmp->execute();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuItem::drawLine(FbDrawable &draw, const MenuTheme &theme, size_t size,
|
||||
|
|
|
@ -64,7 +64,7 @@ void Subject::notify() {
|
|||
m_notify_mode = false;
|
||||
|
||||
// remove dead observers
|
||||
if (m_dead_observers.size()) {
|
||||
if (!m_dead_observers.empty()) {
|
||||
std::for_each(m_dead_observers.begin(),
|
||||
m_dead_observers.end(),
|
||||
std::bind1st(std::mem_fun(&Subject::detach), this));
|
||||
|
|
|
@ -325,7 +325,7 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem, FbTk::StringConve
|
|||
if (submenu == 0)
|
||||
return;
|
||||
|
||||
if (str_cmd.size())
|
||||
if (!str_cmd.empty())
|
||||
submenu->setLabel(str_cmd);
|
||||
else
|
||||
submenu->setLabel(str_label);
|
||||
|
|
|
@ -387,7 +387,7 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
|
|||
|
||||
bool had_error = false;
|
||||
|
||||
if (!str_key.size())
|
||||
if (str_key.empty())
|
||||
continue; //read next line
|
||||
if (strcasecmp(str_key.c_str(), "Workspace") == 0) {
|
||||
unsigned int w;
|
||||
|
|
|
@ -412,7 +412,7 @@ void Toolbar::reconfigure() {
|
|||
|
||||
m_tools = tools; // copy values
|
||||
|
||||
if (m_tools.size()) {
|
||||
if (!m_tools.empty()) {
|
||||
// make lower case
|
||||
transform(m_tools.begin(), m_tools.end(),
|
||||
m_tools.begin(),
|
||||
|
|
Loading…
Reference in a new issue