qt: Fix missing qRegisterMetaType for size_t#17427
Conversation
|
friendly ping @promag |
src/qt/bitcoin.cpp
Outdated
src/qt/bitcoin.cpp
Outdated
There was a problem hiding this comment.
size_t is also using the typedef variant here now too?
There was a problem hiding this comment.
size_t is missed intentionally in this comment, as it is C++'s typedef, not ours.
|
ACK. It's kind of annoying that this can't be a compile-time error (as it's essentially static). Would it help to add checks to the return values of |
|
I think the warning is on emit, not on connect. |
True. |
|
Wait, so there's no way to do static or dynamic checking on this at connect time? That's kind of sucky. It would be good to add a developer note on this, that Qt's signal/slot deceptively look like functions, but the arguments are marshalled internally. This restrict the set of types that can be passed that way. |
src/qt/bitcoin.cpp
Outdated
There was a problem hiding this comment.
I don't like how this commit rewrites and reformats this entire section to add a statement. I'd prefer to split this into two commits: one that adds the missing line, and one that's purely restyling / comment updates.
There was a problem hiding this comment.
Like I said, I also prefer a single line addition.
There was a problem hiding this comment.
I'd prefer to split this into two commits: one that adds the missing line, and one that's purely restyling / comment updates.
Done.
It is required in order to use size_t in QueuedConnections.
40d2256 to
1828c6f
Compare
|
Thanks! |
1828c6f refactor: Styling w/ clang-format, comment update (Hennadii Stepanov) 88a94f7 qt: Fix missing qRegisterMetaType for size_t (Hennadii Stepanov) Pull request description: On master (a7aec7a) 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 1828c6f Tree-SHA512: 2c7f9fe6a5ae70f2e1dd86b07f95d4b00c85c5706a9d722f063f80beb71880d012ec46556963fb1544c2af53d006936c2f7612eae60d9193f67db62ba3d86129
|
qt/test/test_bitcoin-qt gives Fixed in 52b09b3 |
It is required in order to use size_t in QueuedConnections. Github-Pull: bitcoin#17427 Rebased-From: 88a94f7


On master (a7aec7a) this connection
bitcoin/src/qt/rpcconsole.cpp
Line 587 in a7aec7a
ClientModel::mempoolSizeChanged()signal has unregistered parameter typesize_t:bitcoin/src/qt/clientmodel.h
Line 102 in a7aec7a
More:
debug.log:This PR fixes it.
Refs:
Side NOTE: Also I believe this line
bitcoin/src/qt/bitcoin.cpp
Line 63 in a7aec7a
CAmountis atypedef.