diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-03 15:39:35 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2013-02-17 09:36:38 (GMT) |
commit | 850fe76bcb9b33c567f079e4b83fa527e1a5367b (patch) | |
tree | 26990b705e502a365828908c649c6bab4ef5d238 /src | |
parent | f504a958ad6f669b3771a1986fcea9673c7e3e81 (diff) | |
download | fluxbox_pavel-850fe76bcb9b33c567f079e4b83fa527e1a5367b.zip fluxbox_pavel-850fe76bcb9b33c567f079e4b83fa527e1a5367b.tar.bz2 |
Catch and report errors during the creation of menus
Diffstat (limited to 'src')
-rw-r--r-- | src/Screen.cc | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index d19a0b4..0165bfe 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -1387,11 +1387,16 @@ void BScreen::rereadMenu() { | |||
1387 | l.checkstack(1); | 1387 | l.checkstack(1); |
1388 | lua::stack_sentry s(l); | 1388 | lua::stack_sentry s(l); |
1389 | 1389 | ||
1390 | // XXX try/catch | ||
1391 | m_rootmenu->removeAll(); | 1390 | m_rootmenu->removeAll(); |
1392 | l.loadfile(FbTk::StringUtil::expandFilename(fb->getMenuFilename()).c_str()); | 1391 | try { |
1393 | l.call(0, 1); | 1392 | l.loadfile(FbTk::StringUtil::expandFilename(fb->getMenuFilename()).c_str()); |
1394 | MenuCreator::createMenu(*m_rootmenu, l, m_rootmenu->reloadHelper()); | 1393 | l.call(0, 1); |
1394 | MenuCreator::createMenu(*m_rootmenu, l, m_rootmenu->reloadHelper()); | ||
1395 | } | ||
1396 | catch(std::runtime_error &e) { | ||
1397 | cerr << _FB_CONSOLETEXT(Menu, RootLoad, "Loading root menu failed: ", | ||
1398 | "Actual error message follows this string") << e.what() << endl; | ||
1399 | } | ||
1395 | 1400 | ||
1396 | if (m_rootmenu->numberOfItems() == 0) { | 1401 | if (m_rootmenu->numberOfItems() == 0) { |
1397 | _FB_USES_NLS; | 1402 | _FB_USES_NLS; |
@@ -1421,12 +1426,16 @@ void BScreen::rereadWindowMenu() { | |||
1421 | l.checkstack(1); | 1426 | l.checkstack(1); |
1422 | lua::stack_sentry s(l); | 1427 | lua::stack_sentry s(l); |
1423 | 1428 | ||
1424 | |||
1425 | // XXX try/catch | ||
1426 | m_windowmenu->removeAll(); | 1429 | m_windowmenu->removeAll(); |
1427 | l.loadfile(FbTk::StringUtil::expandFilename(windowMenuFilename()).c_str()); | 1430 | try { |
1428 | l.call(0, 1); | 1431 | l.loadfile(FbTk::StringUtil::expandFilename(windowMenuFilename()).c_str()); |
1429 | MenuCreator::createMenu(*m_windowmenu, l, m_windowmenu->reloadHelper()); | 1432 | l.call(0, 1); |
1433 | MenuCreator::createMenu(*m_windowmenu, l, m_windowmenu->reloadHelper()); | ||
1434 | } | ||
1435 | catch(std::runtime_error &e) { | ||
1436 | cerr << _FB_CONSOLETEXT(Menu, RootLoad, "Loading window menu failed: ", | ||
1437 | "Actual error message follows this string") << e.what() << endl; | ||
1438 | } | ||
1430 | } | 1439 | } |
1431 | 1440 | ||
1432 | void BScreen::addConfigMenu(const FbTk::FbString &label, const FbTk::RefCount<FbTk::Menu> &menu) { | 1441 | void BScreen::addConfigMenu(const FbTk::FbString &label, const FbTk::RefCount<FbTk::Menu> &menu) { |