diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-11-10 11:29:51 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-11-10 11:38:53 +0100 |
commit | 89e93135aedf984f7a98771f047e2beb6cdbdb8e (patch) | |
tree | 5b8abb08d4cade20c215f8361a5288cc9b1c2a57 | |
parent | ecc1a4ecd0d2f5f4fa7000516bf881cc1e30191c (diff) | |
parent | 1828c6f05fcbed9ed432b042cc36eee0d80b113d (diff) | |
download | bitcoin-89e93135aedf984f7a98771f047e2beb6cdbdb8e.tar.xz |
Merge #17427: qt: Fix missing qRegisterMetaType for size_t
1828c6f05fcbed9ed432b042cc36eee0d80b113d refactor: Styling w/ clang-format, comment update (Hennadii Stepanov)
88a94f7bb8ba2b0257315d70717f9af928ca6561 qt: Fix missing qRegisterMetaType for size_t (Hennadii Stepanov)
Pull request description:
On master (a7aec7ad97949a82f870c033d8fd8b65d772eacb) this connection https://github.com/bitcoin/bitcoin/blob/a7aec7ad97949a82f870c033d8fd8b65d772eacb/src/qt/rpcconsole.cpp#L587 fails due to `ClientModel::mempoolSizeChanged()` signal has unregistered parameter type `size_t`: https://github.com/bitcoin/bitcoin/blob/a7aec7ad97949a82f870c033d8fd8b65d772eacb/src/qt/clientmodel.h#L102
More:
```
$ QT_FATAL_WARNINGS=1 lldb src/qt/bitcoin-qt -- -debug=qt
...
(lldb) bt
* thread #17, name = 'QThread', stop reason = signal SIGABRT
* frame #0: 0x00007ffff35fce97 libc.so.6`__GI_raise(sig=2) at raise.c:51
frame #1: 0x00007ffff35fe801 libc.so.6`__GI_abort at abort.c:79
frame #2: 0x00007ffff5901352 libQt5Core.so.5`QMessageLogger::warning(char const*, ...) const + 354
frame #3: 0x00007ffff5b216fe libQt5Core.so.5`___lldb_unnamed_symbol2329$$libQt5Core.so.5 + 334
frame #4: 0x00007ffff5b2456d libQt5Core.so.5`QMetaObject::activate(QObject*, int, int, void**) + 1933
frame #5: 0x000055555566872e bitcoin-qt`ClientModel::mempoolSizeChanged(this=<unavailable>, _t1=<unavailable>, _t2=<unavailable>) at moc_clientmodel.cpp:260
...
```
`debug.log`:
```
[] GUI: QObject::connect: Cannot queue arguments of type 'size_t'
(Make sure 'size_t' is registered using qRegisterMetaType().)
```
This PR fixes it.
Refs:
- [Qt docs: qRegisterMetaType](https://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType)
- #16348
---
Side NOTE: Also I believe this line https://github.com/bitcoin/bitcoin/blob/a7aec7ad97949a82f870c033d8fd8b65d772eacb/src/qt/bitcoin.cpp#L63 is redundant since long `CAmount` is a `typedef`.
ACKs for top commit:
laanwj:
Tested ACK 1828c6f05fcbed9ed432b042cc36eee0d80b113d
Tree-SHA512: 2c7f9fe6a5ae70f2e1dd86b07f95d4b00c85c5706a9d722f063f80beb71880d012ec46556963fb1544c2af53d006936c2f7612eae60d9193f67db62ba3d86129
-rw-r--r-- | src/qt/bitcoin.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 234d3865ab..676c15ea43 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -430,16 +430,19 @@ int GuiMain(int argc, char* argv[]) BitcoinApplication app(*node); - // Register meta types used for QMetaObject::invokeMethod - qRegisterMetaType< bool* >(); + // Register meta types used for QMetaObject::invokeMethod and Qt::QueuedConnection + qRegisterMetaType<bool*>(); #ifdef ENABLE_WALLET qRegisterMetaType<WalletModel*>(); #endif - // Need to pass name here as CAmount is a typedef (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType) - // IMPORTANT if it is no longer a typedef use the normal variant above - qRegisterMetaType< CAmount >("CAmount"); - qRegisterMetaType< std::function<void()> >("std::function<void()>"); + // Register typedefs (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType) + // IMPORTANT: if CAmount is no longer a typedef use the normal variant above (see https://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType-1) + qRegisterMetaType<CAmount>("CAmount"); + qRegisterMetaType<size_t>("size_t"); + + qRegisterMetaType<std::function<void()>>("std::function<void()>"); qRegisterMetaType<QMessageBox::Icon>("QMessageBox::Icon"); + /// 2. Parse command-line options. We do this after qt in order to show an error if there are problems parsing these // Command-line options take precedence: node->setupServerArgs(); |