You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bitcoin.cpp 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. // Copyright (c) 2011-2014 The Bitcoin developers
  2. // Distributed under the MIT/X11 software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #if defined(HAVE_CONFIG_H)
  5. #include "config/bitcoin-config.h"
  6. #endif
  7. #include "bitcoingui.h"
  8. #include "clientmodel.h"
  9. #include "guiconstants.h"
  10. #include "guiutil.h"
  11. #include "intro.h"
  12. #include "optionsmodel.h"
  13. #include "splashscreen.h"
  14. #include "utilitydialog.h"
  15. #include "winshutdownmonitor.h"
  16. #ifdef ENABLE_WALLET
  17. #include "paymentserver.h"
  18. #include "walletmodel.h"
  19. #endif
  20. #include "init.h"
  21. #include "main.h"
  22. #include "rpcserver.h"
  23. #include "ui_interface.h"
  24. #include "util.h"
  25. #ifdef ENABLE_WALLET
  26. #include "wallet.h"
  27. #endif
  28. #include <stdint.h>
  29. #include <boost/filesystem/operations.hpp>
  30. #include <QApplication>
  31. #include <QDebug>
  32. #include <QLibraryInfo>
  33. #include <QLocale>
  34. #include <QMessageBox>
  35. #include <QSettings>
  36. #include <QTimer>
  37. #include <QTranslator>
  38. #include <QThread>
  39. #if defined(QT_STATICPLUGIN)
  40. #include <QtPlugin>
  41. #if QT_VERSION < 0x050000
  42. Q_IMPORT_PLUGIN(qcncodecs)
  43. Q_IMPORT_PLUGIN(qjpcodecs)
  44. Q_IMPORT_PLUGIN(qtwcodecs)
  45. Q_IMPORT_PLUGIN(qkrcodecs)
  46. Q_IMPORT_PLUGIN(qtaccessiblewidgets)
  47. #else
  48. Q_IMPORT_PLUGIN(AccessibleFactory)
  49. #if defined(QT_QPA_PLATFORM_XCB)
  50. Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
  51. #elif defined(QT_QPA_PLATFORM_WINDOWS)
  52. Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
  53. #elif defined(QT_QPA_PLATFORM_COCOA)
  54. Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
  55. #endif
  56. #endif
  57. #endif
  58. #if QT_VERSION < 0x050000
  59. #include <QTextCodec>
  60. #endif
  61. // Declare meta types used for QMetaObject::invokeMethod
  62. Q_DECLARE_METATYPE(bool*)
  63. static void InitMessage(const std::string &message)
  64. {
  65. LogPrintf("init message: %s\n", message);
  66. }
  67. /*
  68. Translate string to current locale using Qt.
  69. */
  70. static std::string Translate(const char* psz)
  71. {
  72. return QCoreApplication::translate("bitcoin-core", psz).toStdString();
  73. }
  74. /** Set up translations */
  75. static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTranslator, QTranslator &translatorBase, QTranslator &translator)
  76. {
  77. QSettings settings;
  78. // Remove old translators
  79. QApplication::removeTranslator(&qtTranslatorBase);
  80. QApplication::removeTranslator(&qtTranslator);
  81. QApplication::removeTranslator(&translatorBase);
  82. QApplication::removeTranslator(&translator);
  83. // Get desired locale (e.g. "de_DE")
  84. // 1) System default language
  85. QString lang_territory = QLocale::system().name();
  86. // 2) Language from QSettings
  87. QString lang_territory_qsettings = settings.value("language", "").toString();
  88. if(!lang_territory_qsettings.isEmpty())
  89. lang_territory = lang_territory_qsettings;
  90. // 3) -lang command line argument
  91. lang_territory = QString::fromStdString(GetArg("-lang", lang_territory.toStdString()));
  92. // Convert to "de" only by truncating "_DE"
  93. QString lang = lang_territory;
  94. lang.truncate(lang_territory.lastIndexOf('_'));
  95. // Load language files for configured locale:
  96. // - First load the translator for the base language, without territory
  97. // - Then load the more specific locale translator
  98. // Load e.g. qt_de.qm
  99. if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
  100. QApplication::installTranslator(&qtTranslatorBase);
  101. // Load e.g. qt_de_DE.qm
  102. if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
  103. QApplication::installTranslator(&qtTranslator);
  104. // Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc)
  105. if (translatorBase.load(lang, ":/translations/"))
  106. QApplication::installTranslator(&translatorBase);
  107. // Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc)
  108. if (translator.load(lang_territory, ":/translations/"))
  109. QApplication::installTranslator(&translator);
  110. }
  111. /* qDebug() message handler --> debug.log */
  112. #if QT_VERSION < 0x050000
  113. void DebugMessageHandler(QtMsgType type, const char *msg)
  114. {
  115. const char *category = (type == QtDebugMsg) ? "qt" : NULL;
  116. LogPrint(category, "GUI: %s\n", msg);
  117. }
  118. #else
  119. void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &msg)
  120. {
  121. Q_UNUSED(context);
  122. const char *category = (type == QtDebugMsg) ? "qt" : NULL;
  123. LogPrint(category, "GUI: %s\n", msg.toStdString());
  124. }
  125. #endif
  126. /** Class encapsulating Bitcoin Core startup and shutdown.
  127. * Allows running startup and shutdown in a different thread from the UI thread.
  128. */
  129. class BitcoinCore: public QObject
  130. {
  131. Q_OBJECT
  132. public:
  133. explicit BitcoinCore();
  134. public slots:
  135. void initialize();
  136. void shutdown();
  137. signals:
  138. void initializeResult(int retval);
  139. void shutdownResult(int retval);
  140. void runawayException(const QString &message);
  141. private:
  142. boost::thread_group threadGroup;
  143. /// Pass fatal exception message to UI thread
  144. void handleRunawayException(std::exception *e);
  145. };
  146. /** Main Bitcoin application object */
  147. class BitcoinApplication: public QApplication
  148. {
  149. Q_OBJECT
  150. public:
  151. explicit BitcoinApplication(int &argc, char **argv);
  152. ~BitcoinApplication();
  153. #ifdef ENABLE_WALLET
  154. /// Create payment server
  155. void createPaymentServer();
  156. #endif
  157. /// Create options model
  158. void createOptionsModel();
  159. /// Create main window
  160. void createWindow(bool isaTestNet);
  161. /// Create splash screen
  162. void createSplashScreen(bool isaTestNet);
  163. /// Request core initialization
  164. void requestInitialize();
  165. /// Request core shutdown
  166. void requestShutdown();
  167. /// Get process return value
  168. int getReturnValue() { return returnValue; }
  169. /// Get window identifier of QMainWindow (BitcoinGUI)
  170. WId getMainWinId() const;
  171. public slots:
  172. void initializeResult(int retval);
  173. void shutdownResult(int retval);
  174. /// Handle runaway exceptions. Shows a message box with the problem and quits the program.
  175. void handleRunawayException(const QString &message);
  176. signals:
  177. void requestedInitialize();
  178. void requestedShutdown();
  179. void stopThread();
  180. void splashFinished(QWidget *window);
  181. private:
  182. QThread *coreThread;
  183. OptionsModel *optionsModel;
  184. ClientModel *clientModel;
  185. BitcoinGUI *window;
  186. QTimer *pollShutdownTimer;
  187. #ifdef ENABLE_WALLET
  188. PaymentServer* paymentServer;
  189. WalletModel *walletModel;
  190. #endif
  191. int returnValue;
  192. void startThread();
  193. };
  194. #include "bitcoin.moc"
  195. BitcoinCore::BitcoinCore():
  196. QObject()
  197. {
  198. }
  199. void BitcoinCore::handleRunawayException(std::exception *e)
  200. {
  201. PrintExceptionContinue(e, "Runaway exception");
  202. emit runawayException(QString::fromStdString(strMiscWarning));
  203. }
  204. void BitcoinCore::initialize()
  205. {
  206. try
  207. {
  208. qDebug() << __func__ << ": Running AppInit2 in thread";
  209. int rv = AppInit2(threadGroup);
  210. if(rv)
  211. {
  212. /* Start a dummy RPC thread if no RPC thread is active yet
  213. * to handle timeouts.
  214. */
  215. StartDummyRPCThread();
  216. }
  217. emit initializeResult(rv);
  218. } catch (std::exception& e) {
  219. handleRunawayException(&e);
  220. } catch (...) {
  221. handleRunawayException(NULL);
  222. }
  223. }
  224. void BitcoinCore::shutdown()
  225. {
  226. try
  227. {
  228. qDebug() << __func__ << ": Running Shutdown in thread";
  229. threadGroup.interrupt_all();
  230. threadGroup.join_all();
  231. Shutdown();
  232. qDebug() << __func__ << ": Shutdown finished";
  233. emit shutdownResult(1);
  234. } catch (std::exception& e) {
  235. handleRunawayException(&e);
  236. } catch (...) {
  237. handleRunawayException(NULL);
  238. }
  239. }
  240. BitcoinApplication::BitcoinApplication(int &argc, char **argv):
  241. QApplication(argc, argv),
  242. coreThread(0),
  243. optionsModel(0),
  244. clientModel(0),
  245. window(0),
  246. pollShutdownTimer(0),
  247. #ifdef ENABLE_WALLET
  248. paymentServer(0),
  249. walletModel(0),
  250. #endif
  251. returnValue(0)
  252. {
  253. setQuitOnLastWindowClosed(false);
  254. }
  255. BitcoinApplication::~BitcoinApplication()
  256. {
  257. if(coreThread)
  258. {
  259. qDebug() << __func__ << ": Stopping thread";
  260. emit stopThread();
  261. coreThread->wait();
  262. qDebug() << __func__ << ": Stopped thread";
  263. }
  264. delete window;
  265. window = 0;
  266. #ifdef ENABLE_WALLET
  267. delete paymentServer;
  268. paymentServer = 0;
  269. #endif
  270. delete optionsModel;
  271. optionsModel = 0;
  272. }
  273. #ifdef ENABLE_WALLET
  274. void BitcoinApplication::createPaymentServer()
  275. {
  276. paymentServer = new PaymentServer(this);
  277. }
  278. #endif
  279. void BitcoinApplication::createOptionsModel()
  280. {
  281. optionsModel = new OptionsModel();
  282. }
  283. void BitcoinApplication::createWindow(bool isaTestNet)
  284. {
  285. window = new BitcoinGUI(isaTestNet, 0);
  286. pollShutdownTimer = new QTimer(window);
  287. connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown()));
  288. pollShutdownTimer->start(200);
  289. }
  290. void BitcoinApplication::createSplashScreen(bool isaTestNet)
  291. {
  292. SplashScreen *splash = new SplashScreen(QPixmap(), 0, isaTestNet);
  293. splash->setAttribute(Qt::WA_DeleteOnClose);
  294. splash->show();
  295. connect(this, SIGNAL(splashFinished(QWidget*)), splash, SLOT(slotFinish(QWidget*)));
  296. }
  297. void BitcoinApplication::startThread()
  298. {
  299. if(coreThread)
  300. return;
  301. coreThread = new QThread(this);
  302. BitcoinCore *executor = new BitcoinCore();
  303. executor->moveToThread(coreThread);
  304. /* communication to and from thread */
  305. connect(executor, SIGNAL(initializeResult(int)), this, SLOT(initializeResult(int)));
  306. connect(executor, SIGNAL(shutdownResult(int)), this, SLOT(shutdownResult(int)));
  307. connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString)));
  308. connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize()));
  309. connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown()));
  310. /* make sure executor object is deleted in its own thread */
  311. connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater()));
  312. connect(this, SIGNAL(stopThread()), coreThread, SLOT(quit()));
  313. coreThread->start();
  314. }
  315. void BitcoinApplication::requestInitialize()
  316. {
  317. qDebug() << __func__ << ": Requesting initialize";
  318. startThread();
  319. emit requestedInitialize();
  320. }
  321. void BitcoinApplication::requestShutdown()
  322. {
  323. qDebug() << __func__ << ": Requesting shutdown";
  324. startThread();
  325. window->hide();
  326. window->setClientModel(0);
  327. pollShutdownTimer->stop();
  328. #ifdef ENABLE_WALLET
  329. window->removeAllWallets();
  330. delete walletModel;
  331. walletModel = 0;
  332. #endif
  333. delete clientModel;
  334. clientModel = 0;
  335. // Show a simple window indicating shutdown status
  336. ShutdownWindow::showShutdownWindow(window);
  337. // Request shutdown from core thread
  338. emit requestedShutdown();
  339. }
  340. void BitcoinApplication::initializeResult(int retval)
  341. {
  342. qDebug() << __func__ << ": Initialization result: " << retval;
  343. // Set exit result: 0 if successful, 1 if failure
  344. returnValue = retval ? 0 : 1;
  345. if(retval)
  346. {
  347. #ifdef ENABLE_WALLET
  348. PaymentServer::LoadRootCAs();
  349. paymentServer->setOptionsModel(optionsModel);
  350. #endif
  351. clientModel = new ClientModel(optionsModel);
  352. window->setClientModel(clientModel);
  353. #ifdef ENABLE_WALLET
  354. if(pwalletMain)
  355. {
  356. walletModel = new WalletModel(pwalletMain, optionsModel);
  357. window->addWallet("~Default", walletModel);
  358. window->setCurrentWallet("~Default");
  359. connect(walletModel, SIGNAL(coinsSent(CWallet*,SendCoinsRecipient,QByteArray)),
  360. paymentServer, SLOT(fetchPaymentACK(CWallet*,const SendCoinsRecipient&,QByteArray)));
  361. }
  362. #endif
  363. emit splashFinished(window);
  364. // If -min option passed, start window minimized.
  365. if(GetBoolArg("-min", false))
  366. {
  367. window->showMinimized();
  368. }
  369. else
  370. {
  371. window->show();
  372. }
  373. #ifdef ENABLE_WALLET
  374. // Now that initialization/startup is done, process any command-line
  375. // bitcoin: URIs or payment requests:
  376. connect(paymentServer, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)),
  377. window, SLOT(handlePaymentRequest(SendCoinsRecipient)));
  378. connect(window, SIGNAL(receivedURI(QString)),
  379. paymentServer, SLOT(handleURIOrFile(QString)));
  380. connect(paymentServer, SIGNAL(message(QString,QString,unsigned int)),
  381. window, SLOT(message(QString,QString,unsigned int)));
  382. QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
  383. #endif
  384. } else {
  385. quit(); // Exit main loop
  386. }
  387. }
  388. void BitcoinApplication::shutdownResult(int retval)
  389. {
  390. qDebug() << __func__ << ": Shutdown result: " << retval;
  391. quit(); // Exit main loop after shutdown finished
  392. }
  393. void BitcoinApplication::handleRunawayException(const QString &message)
  394. {
  395. QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Bitcoin can no longer continue safely and will quit.") + QString("\n\n") + message);
  396. ::exit(1);
  397. }
  398. WId BitcoinApplication::getMainWinId() const
  399. {
  400. if (!window)
  401. return 0;
  402. return window->winId();
  403. }
  404. #ifndef BITCOIN_QT_TEST
  405. int main(int argc, char *argv[])
  406. {
  407. SetupEnvironment();
  408. /// 1. Parse command-line options. These take precedence over anything else.
  409. // Command-line options take precedence:
  410. ParseParameters(argc, argv);
  411. // Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory
  412. /// 2. Basic Qt initialization (not dependent on parameters or configuration)
  413. #if QT_VERSION < 0x050000
  414. // Internal string conversion is all UTF-8
  415. QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
  416. QTextCodec::setCodecForCStrings(QTextCodec::codecForTr());
  417. #endif
  418. Q_INIT_RESOURCE(bitcoin);
  419. Q_INIT_RESOURCE(bitcoin_locale);
  420. BitcoinApplication app(argc, argv);
  421. #if QT_VERSION > 0x050100
  422. // Generate high-dpi pixmaps
  423. QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
  424. #endif
  425. #ifdef Q_OS_MAC
  426. QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
  427. #endif
  428. // Register meta types used for QMetaObject::invokeMethod
  429. qRegisterMetaType< bool* >();
  430. /// 3. Application identification
  431. // must be set before OptionsModel is initialized or translations are loaded,
  432. // as it is used to locate QSettings
  433. QApplication::setOrganizationName(QAPP_ORG_NAME);
  434. QApplication::setOrganizationDomain(QAPP_ORG_DOMAIN);
  435. QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT);
  436. /// 4. Initialization of translations, so that intro dialog is in user's language
  437. // Now that QSettings are accessible, initialize translations
  438. QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;
  439. initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
  440. uiInterface.Translate.connect(Translate);
  441. // Show help message immediately after parsing command-line options (for "-lang") and setting locale,
  442. // but before showing splash screen.
  443. if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version"))
  444. {
  445. HelpMessageDialog help(NULL, mapArgs.count("-version"));
  446. help.showOrPrint();
  447. return 1;
  448. }
  449. /// 5. Now that settings and translations are available, ask user for data directory
  450. // User language is set up: pick a data directory
  451. Intro::pickDataDirectory();
  452. /// 6. Determine availability of data directory and parse bitcoin.conf
  453. /// - Do not call GetDataDir(true) before this step finishes
  454. if (!boost::filesystem::is_directory(GetDataDir(false)))
  455. {
  456. QMessageBox::critical(0, QObject::tr("Bitcoin Core"),
  457. QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
  458. return 1;
  459. }
  460. try {
  461. ReadConfigFile(mapArgs, mapMultiArgs);
  462. } catch(std::exception &e) {
  463. QMessageBox::critical(0, QObject::tr("Bitcoin Core"),
  464. QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what()));
  465. return false;
  466. }
  467. /// 7. Determine network (and switch to network specific options)
  468. // - Do not call Params() before this step
  469. // - Do this after parsing the configuration file, as the network can be switched there
  470. // - QSettings() will use the new application name after this, resulting in network-specific settings
  471. // - Needs to be done before createOptionsModel
  472. // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
  473. if (!SelectParamsFromCommandLine()) {
  474. QMessageBox::critical(0, QObject::tr("Bitcoin Core"), QObject::tr("Error: Invalid combination of -regtest and -testnet."));
  475. return 1;
  476. }
  477. #ifdef ENABLE_WALLET
  478. // Parse URIs on command line -- this can affect Params()
  479. if (!PaymentServer::ipcParseCommandLine(argc, argv))
  480. exit(0);
  481. #endif
  482. bool isaTestNet = Params().NetworkID() != CBaseChainParams::MAIN;
  483. // Allow for separate UI settings for testnets
  484. if (isaTestNet)
  485. QApplication::setApplicationName(QAPP_APP_NAME_TESTNET);
  486. else
  487. QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT);
  488. // Re-initialize translations after changing application name (language in network-specific settings can be different)
  489. initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
  490. #ifdef ENABLE_WALLET
  491. /// 8. URI IPC sending
  492. // - Do this early as we don't want to bother initializing if we are just calling IPC
  493. // - Do this *after* setting up the data directory, as the data directory hash is used in the name
  494. // of the server.
  495. // - Do this after creating app and setting up translations, so errors are
  496. // translated properly.
  497. if (PaymentServer::ipcSendCommandLine())
  498. exit(0);
  499. // Start up the payment server early, too, so impatient users that click on
  500. // bitcoin: links repeatedly have their payment requests routed to this process:
  501. app.createPaymentServer();
  502. #endif
  503. /// 9. Main GUI initialization
  504. // Install global event filter that makes sure that long tooltips can be word-wrapped
  505. app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
  506. #if QT_VERSION < 0x050000
  507. // Install qDebug() message handler to route to debug.log
  508. qInstallMsgHandler(DebugMessageHandler);
  509. #else
  510. #if defined(Q_OS_WIN)
  511. // Install global event filter for processing Windows session related Windows messages (WM_QUERYENDSESSION and WM_ENDSESSION)
  512. qApp->installNativeEventFilter(new WinShutdownMonitor());
  513. #endif
  514. // Install qDebug() message handler to route to debug.log
  515. qInstallMessageHandler(DebugMessageHandler);
  516. #endif
  517. // Load GUI settings from QSettings
  518. app.createOptionsModel();
  519. // Subscribe to global signals from core
  520. uiInterface.InitMessage.connect(InitMessage);
  521. if (GetBoolArg("-splash", true) && !GetBoolArg("-min", false))
  522. app.createSplashScreen(isaTestNet);
  523. try
  524. {
  525. app.createWindow(isaTestNet);
  526. app.requestInitialize();
  527. #if defined(Q_OS_WIN) && QT_VERSION >= 0x050000
  528. WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("Bitcoin Core didn't yet exit safely..."), (HWND)app.getMainWinId());
  529. #endif
  530. app.exec();
  531. app.requestShutdown();
  532. app.exec();
  533. } catch (std::exception& e) {
  534. PrintExceptionContinue(&e, "Runaway exception");
  535. app.handleRunawayException(QString::fromStdString(strMiscWarning));
  536. } catch (...) {
  537. PrintExceptionContinue(NULL, "Runaway exception");
  538. app.handleRunawayException(QString::fromStdString(strMiscWarning));
  539. }
  540. return app.getReturnValue();
  541. }
  542. #endif // BITCOIN_QT_TEST