0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-13 11:25:02 -05:00

qt: Replace GUIUtil::ObjectInvoke() with QMetaObject::invokeMethod()

The `GUIUtil::ObjectInvoke()` template function was a replacement of
the `QMetaObject::invokeMethod()` functor overload which is available
in Qt 5.10+.

No behavior change.
This commit is contained in:
Hennadii Stepanov 2022-04-16 19:18:25 +02:00
parent d1b3dfb275
commit 249984f4f9
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 5 additions and 4 deletions

View file

@ -5,13 +5,13 @@
#include <qt/initexecutor.h> #include <qt/initexecutor.h>
#include <interfaces/node.h> #include <interfaces/node.h>
#include <qt/guiutil.h>
#include <util/system.h> #include <util/system.h>
#include <util/threadnames.h> #include <util/threadnames.h>
#include <exception> #include <exception>
#include <QDebug> #include <QDebug>
#include <QMetaObject>
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QThread> #include <QThread>
@ -39,7 +39,7 @@ void InitExecutor::handleRunawayException(const std::exception* e)
void InitExecutor::initialize() void InitExecutor::initialize()
{ {
GUIUtil::ObjectInvoke(&m_context, [this] { QMetaObject::invokeMethod(&m_context, [this] {
try { try {
util::ThreadRename("qt-init"); util::ThreadRename("qt-init");
qDebug() << "Running initialization in thread"; qDebug() << "Running initialization in thread";
@ -56,7 +56,7 @@ void InitExecutor::initialize()
void InitExecutor::shutdown() void InitExecutor::shutdown()
{ {
GUIUtil::ObjectInvoke(&m_context, [this] { QMetaObject::invokeMethod(&m_context, [this] {
try { try {
qDebug() << "Running Shutdown in thread"; qDebug() << "Running Shutdown in thread";
m_node.appShutdown(); m_node.appShutdown();

View file

@ -24,6 +24,7 @@
#include <QApplication> #include <QApplication>
#include <QMessageBox> #include <QMessageBox>
#include <QMetaObject>
#include <QMutexLocker> #include <QMutexLocker>
#include <QThread> #include <QThread>
#include <QTimer> #include <QTimer>
@ -135,7 +136,7 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
// handled on the GUI event loop. // handled on the GUI event loop.
wallet_model->moveToThread(thread()); wallet_model->moveToThread(thread());
// setParent(parent) must be called in the thread which created the parent object. More details in #18948. // setParent(parent) must be called in the thread which created the parent object. More details in #18948.
GUIUtil::ObjectInvoke(this, [wallet_model, this] { QMetaObject::invokeMethod(this, [wallet_model, this] {
wallet_model->setParent(this); wallet_model->setParent(this);
}, GUIUtil::blockingGUIThreadConnection()); }, GUIUtil::blockingGUIThreadConnection());