Merge bitcoin-core/gui#586: Getting ready to Qt 6 (6/n). Replace QCoreApplication::quit() with QCoreApplication::exit(0)

252f363f2f qt: Replace `QCoreApplication::quit()` with `QCoreApplication::exit(0)` (Hennadii Stepanov)

Pull request description:

  ### Qt 5:
   - no behavior change.

  See https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/kernel/qcoreapplication.cpp?h=5.15#n2012:
  ```cpp
  void QCoreApplication::quit()
  {
      exit(0);
  }
  ```

  ### Qt 6:
   - this change avoids sending a duplicated `QEvent::Quit`

  We use `QEvent::Quit` to [handle](https://github.com/bitcoin-core/gui/pull/547) macOS dock menu events. Qt 6 uses `QEvent::Quit` more [widely](89f7a2759c). We do not want a duplicated `QEvent::Quit` which fires `Assert(node.args);` in the [`Shutdown()`](d1b3dfb275/src/init.cpp (L200)) function.

ACKs for top commit:
  promag:
    Code review ACK 252f363f2f.

Tree-SHA512: 6a04cbcf523c0375158a59b29afadf18da99738c8db8b8728f99319a8cdc10806d2f06dc5a7d3b8b0e1a5f1711be778a75d4ecdefef7cf66e26ae2848f7f57db
This commit is contained in:
Hennadii Stepanov 2022-05-23 08:56:11 +02:00
commit dfe11a1a7e
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F
2 changed files with 4 additions and 2 deletions

View File

@ -308,7 +308,9 @@ void BitcoinApplication::startThread()
/* communication to and from thread */
connect(&m_executor.value(), &InitExecutor::initializeResult, this, &BitcoinApplication::initializeResult);
connect(&m_executor.value(), &InitExecutor::shutdownResult, this, &QCoreApplication::quit);
connect(&m_executor.value(), &InitExecutor::shutdownResult, this, [] {
QCoreApplication::exit(0);
});
connect(&m_executor.value(), &InitExecutor::runawayException, this, &BitcoinApplication::handleRunawayException);
connect(this, &BitcoinApplication::requestedInitialize, &m_executor.value(), &InitExecutor::initialize);
connect(this, &BitcoinApplication::requestedShutdown, &m_executor.value(), &InitExecutor::shutdown);

View File

@ -119,6 +119,6 @@ AppTests::HandleCallback::~HandleCallback()
assert(it != callbacks.end());
callbacks.erase(it);
if (callbacks.empty()) {
m_app_tests.m_app.quit();
m_app_tests.m_app.exit(0);
}
}