Skip to content

Commit ea267eb

Browse files
committed
Merge #177: Update block tip in the gui thread
eca5252 qml: Update block tip in the gui thread (João Barbosa) Pull request description: This takes commit cf8a278 from #38 and rebases it over changes on master; namely that we've dropped `GUIUtil::ObjectInvoke` in favor of `QMetaObject::invokeMethod`. This avoids non-thread-safe errors. I ran into a segfault here while running some data intensive monkey-code related to blocks, this change prevented it. I'm not going to actually use the code that caused the segfault, just to illustrate that this is useful here anyways. [![Windows](https://img.shields.io/badge/OS-Windows-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/177) [![Intel macOS](https://img.shields.io/badge/OS-Intel%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/177) [![Apple Silicon macOS](https://img.shields.io/badge/OS-Apple%20Silicon%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/177) [![ARM64 Android](https://img.shields.io/badge/OS-Android-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/177) ACKs for top commit: hebasto: ACK eca5252, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: 9faf9b486af15f29ace20c9cb55ba65f3e20d23f4b7dc58908589f9a104b47cebe575a2a88935ed5f1a2fafc8bc41088084f28803990db64715e235da4c6461f
2 parents dbec1a9 + eca5252 commit ea267eb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/qml/nodemodel.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <cassert>
1111
#include <chrono>
1212

13+
#include <QMetaObject>
1314
#include <QTimerEvent>
1415

1516
NodeModel::NodeModel(interfaces::Node& node)
@@ -71,7 +72,9 @@ void NodeModel::ConnectToBlockTipSignal()
7172

7273
m_handler_notify_block_tip = m_node.handleNotifyBlockTip(
7374
[this](SynchronizationState state, interfaces::BlockTip tip, double verification_progress) {
74-
setBlockTipHeight(tip.block_height);
75-
setVerificationProgress(verification_progress);
75+
QMetaObject::invokeMethod(this, [=] {
76+
setBlockTipHeight(tip.block_height);
77+
setVerificationProgress(verification_progress);
78+
});
7679
});
7780
}

0 commit comments

Comments
 (0)