diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-03 15:39:35 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-11-01 09:57:21 (GMT) |
commit | d2fb2a43cb73c5806d1dae2c3d7b7065a0e3628c (patch) | |
tree | 4cbdd6670f96375e6240e1861666f517ae2e20f2 | |
parent | 99cd3491e20d65f100e9693f879b9ef9e6d10687 (diff) | |
download | fluxbox_paul-d2fb2a43cb73c5806d1dae2c3d7b7065a0e3628c.zip fluxbox_paul-d2fb2a43cb73c5806d1dae2c3d7b7065a0e3628c.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 a5b7d59..55b74bc 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -1368,11 +1368,16 @@ void BScreen::rereadMenu() { | |||
1368 | l.checkstack(1); | 1368 | l.checkstack(1); |
1369 | lua::stack_sentry s(l); | 1369 | lua::stack_sentry s(l); |
1370 | 1370 | ||
1371 | // XXX try/catch | ||
1372 | m_rootmenu->removeAll(); | 1371 | m_rootmenu->removeAll(); |
1373 | l.loadfile(FbTk::StringUtil::expandFilename(fb->getMenuFilename()).c_str()); | 1372 | try { |
1374 | l.call(0, 1); | 1373 | l.loadfile(FbTk::StringUtil::expandFilename(fb->getMenuFilename()).c_str()); |
1375 | MenuCreator::createMenu(*m_rootmenu, l, m_rootmenu->reloadHelper()); | 1374 | l.call(0, 1); |
1375 | MenuCreator::createMenu(*m_rootmenu, l, m_rootmenu->reloadHelper()); | ||
1376 | } | ||
1377 | catch(std::runtime_error &e) { | ||
1378 | cerr << _FB_CONSOLETEXT(Menu, RootLoad, "Loading root menu failed: ", | ||
1379 | "Actual error message follows this string") << e.what() << endl; | ||
1380 | } | ||
1376 | 1381 | ||
1377 | if (m_rootmenu->numberOfItems() == 0) { | 1382 | if (m_rootmenu->numberOfItems() == 0) { |
1378 | _FB_USES_NLS; | 1383 | _FB_USES_NLS; |
@@ -1402,12 +1407,16 @@ void BScreen::rereadWindowMenu() { | |||
1402 | l.checkstack(1); | 1407 | l.checkstack(1); |
1403 | lua::stack_sentry s(l); | 1408 | lua::stack_sentry s(l); |
1404 | 1409 | ||
1405 | |||
1406 | // XXX try/catch | ||
1407 | m_windowmenu->removeAll(); | 1410 | m_windowmenu->removeAll(); |
1408 | l.loadfile(FbTk::StringUtil::expandFilename(windowMenuFilename()).c_str()); | 1411 | try { |
1409 | l.call(0, 1); | 1412 | l.loadfile(FbTk::StringUtil::expandFilename(windowMenuFilename()).c_str()); |
1410 | MenuCreator::createMenu(*m_windowmenu, l, m_windowmenu->reloadHelper()); | 1413 | l.call(0, 1); |
1414 | MenuCreator::createMenu(*m_windowmenu, l, m_windowmenu->reloadHelper()); | ||
1415 | } | ||
1416 | catch(std::runtime_error &e) { | ||
1417 | cerr << _FB_CONSOLETEXT(Menu, RootLoad, "Loading window menu failed: ", | ||
1418 | "Actual error message follows this string") << e.what() << endl; | ||
1419 | } | ||
1411 | } | 1420 | } |
1412 | 1421 | ||
1413 | void BScreen::addConfigMenu(const FbTk::FbString &label, const FbTk::RefCount<FbTk::Menu> &menu) { | 1422 | void BScreen::addConfigMenu(const FbTk::FbString &label, const FbTk::RefCount<FbTk::Menu> &menu) { |