Skip to content

Commit b00ba62

Browse files
committed
Merge #9834: qt: clean up initialize/shutdown signals
5b528d7 qt: clean up initialize/shutdown signals (Marko Bencun) Tree-SHA512: 4a8326ba05a1cc037203a7abe01d4e77b6ff83e62ec14f09834ada4b35a23ffb1f28b5587aa2e02601f0f6c7d62c5647a7f10320239b4bac132791be29930ddb
2 parents d19d45a + 5b528d7 commit b00ba62

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/qt/bitcoin.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ public Q_SLOTS:
178178
void shutdown();
179179

180180
Q_SIGNALS:
181-
void initializeResult(int retval);
182-
void shutdownResult(int retval);
181+
void initializeResult(bool success);
182+
void shutdownResult();
183183
void runawayException(const QString &message);
184184

185185
private:
@@ -223,8 +223,8 @@ class BitcoinApplication: public QApplication
223223
WId getMainWinId() const;
224224

225225
public Q_SLOTS:
226-
void initializeResult(int retval);
227-
void shutdownResult(int retval);
226+
void initializeResult(bool success);
227+
void shutdownResult();
228228
/// Handle runaway exceptions. Shows a message box with the problem and quits the program.
229229
void handleRunawayException(const QString &message);
230230

@@ -284,7 +284,7 @@ void BitcoinCore::initialize()
284284
Q_EMIT initializeResult(false);
285285
return;
286286
}
287-
int rv = AppInitMain(threadGroup, scheduler);
287+
bool rv = AppInitMain(threadGroup, scheduler);
288288
Q_EMIT initializeResult(rv);
289289
} catch (const std::exception& e) {
290290
handleRunawayException(&e);
@@ -302,7 +302,7 @@ void BitcoinCore::shutdown()
302302
threadGroup.join_all();
303303
Shutdown();
304304
qDebug() << __func__ << ": Shutdown finished";
305-
Q_EMIT shutdownResult(1);
305+
Q_EMIT shutdownResult();
306306
} catch (const std::exception& e) {
307307
handleRunawayException(&e);
308308
} catch (...) {
@@ -398,8 +398,8 @@ void BitcoinApplication::startThread()
398398
executor->moveToThread(coreThread);
399399

400400
/* communication to and from thread */
401-
connect(executor, SIGNAL(initializeResult(int)), this, SLOT(initializeResult(int)));
402-
connect(executor, SIGNAL(shutdownResult(int)), this, SLOT(shutdownResult(int)));
401+
connect(executor, SIGNAL(initializeResult(bool)), this, SLOT(initializeResult(bool)));
402+
connect(executor, SIGNAL(shutdownResult()), this, SLOT(shutdownResult()));
403403
connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString)));
404404
connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize()));
405405
connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown()));
@@ -450,12 +450,12 @@ void BitcoinApplication::requestShutdown()
450450
Q_EMIT requestedShutdown();
451451
}
452452

453-
void BitcoinApplication::initializeResult(int retval)
453+
void BitcoinApplication::initializeResult(bool success)
454454
{
455-
qDebug() << __func__ << ": Initialization result: " << retval;
456-
// Set exit result: 0 if successful, 1 if failure
457-
returnValue = retval ? 0 : 1;
458-
if(retval)
455+
qDebug() << __func__ << ": Initialization result: " << success;
456+
// Set exit result.
457+
returnValue = success ? EXIT_SUCCESS : EXIT_FAILURE;
458+
if(success)
459459
{
460460
// Log this only after AppInitMain finishes, as then logging setup is guaranteed complete
461461
qWarning() << "Platform customization:" << platformStyle->getName();
@@ -507,9 +507,8 @@ void BitcoinApplication::initializeResult(int retval)
507507
}
508508
}
509509

510-
void BitcoinApplication::shutdownResult(int retval)
510+
void BitcoinApplication::shutdownResult()
511511
{
512-
qDebug() << __func__ << ": Shutdown result: " << retval;
513512
quit(); // Exit main loop after shutdown finished
514513
}
515514

0 commit comments

Comments
 (0)