diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-03 15:39:35 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-07-03 15:39:35 (GMT) |
commit | aad4bcdeaa92e0e3ec857c38dc3846e216728f5b (patch) | |
tree | 8535b5aa1cdf35d5801db7715183d7abed04b213 | |
parent | 3da1a57f02e95c247b2c6c918e4a76cbc93c466f (diff) | |
download | fluxbox_pavel-aad4bcdeaa92e0e3ec857c38dc3846e216728f5b.zip fluxbox_pavel-aad4bcdeaa92e0e3ec857c38dc3846e216728f5b.tar.bz2 |
Catch and report errors during the creation of menus
-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 f6af80e..414af85 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -1376,11 +1376,16 @@ void BScreen::rereadMenu() { | |||
1376 | l.checkstack(1); | 1376 | l.checkstack(1); |
1377 | lua::stack_sentry s(l); | 1377 | lua::stack_sentry s(l); |
1378 | 1378 | ||
1379 | // XXX try/catch | ||
1380 | m_rootmenu->removeAll(); | 1379 | m_rootmenu->removeAll(); |
1381 | l.loadfile(FbTk::StringUtil::expandFilename(fb->getMenuFilename()).c_str()); | 1380 | try { |
1382 | l.call(0, 1); | 1381 | l.loadfile(FbTk::StringUtil::expandFilename(fb->getMenuFilename()).c_str()); |
1383 | MenuCreator::createMenu(*m_rootmenu, l, m_rootmenu->reloadHelper()); | 1382 | l.call(0, 1); |
1383 | MenuCreator::createMenu(*m_rootmenu, l, m_rootmenu->reloadHelper()); | ||
1384 | } | ||
1385 | catch(std::runtime_error &e) { | ||
1386 | cerr << _FB_CONSOLETEXT(Menu, RootLoad, "Loading root menu failed: ", | ||
1387 | "Actual error message follows this string") << e.what() << endl; | ||
1388 | } | ||
1384 | 1389 | ||
1385 | if (m_rootmenu->numberOfItems() == 0) { | 1390 | if (m_rootmenu->numberOfItems() == 0) { |
1386 | _FB_USES_NLS; | 1391 | _FB_USES_NLS; |
@@ -1410,12 +1415,16 @@ void BScreen::rereadWindowMenu() { | |||
1410 | l.checkstack(1); | 1415 | l.checkstack(1); |
1411 | lua::stack_sentry s(l); | 1416 | lua::stack_sentry s(l); |
1412 | 1417 | ||
1413 | |||
1414 | // XXX try/catch | ||
1415 | m_windowmenu->removeAll(); | 1418 | m_windowmenu->removeAll(); |
1416 | l.loadfile(FbTk::StringUtil::expandFilename(windowMenuFilename()).c_str()); | 1419 | try { |
1417 | l.call(0, 1); | 1420 | l.loadfile(FbTk::StringUtil::expandFilename(windowMenuFilename()).c_str()); |
1418 | MenuCreator::createMenu(*m_windowmenu, l, m_windowmenu->reloadHelper()); | 1421 | l.call(0, 1); |
1422 | MenuCreator::createMenu(*m_windowmenu, l, m_windowmenu->reloadHelper()); | ||
1423 | } | ||
1424 | catch(std::runtime_error &e) { | ||
1425 | cerr << _FB_CONSOLETEXT(Menu, RootLoad, "Loading window menu failed: ", | ||
1426 | "Actual error message follows this string") << e.what() << endl; | ||
1427 | } | ||
1419 | } | 1428 | } |
1420 | 1429 | ||
1421 | void BScreen::addConfigMenu(const FbTk::FbString &label, const FbTk::RefCount<FbTk::Menu> &menu) { | 1430 | void BScreen::addConfigMenu(const FbTk::FbString &label, const FbTk::RefCount<FbTk::Menu> &menu) { |