-
Notifications
You must be signed in to change notification settings - Fork 293
Segfault during shutdown in SendCoinsDialog::updateCoinControlState #862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I guess this is a race from the block tip event (probably optimized out in the bt) and the wallet unloading. |
Steps to reproduce:
diff --git a/src/init.cpp b/src/init.cpp
index f35a547c92..7c5fc7f65f 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1885,7 +1885,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
int64_t best_block_time{};
{
LOCK(chainman.GetMutex());
- const auto& tip{*Assert(chainman.ActiveTip())};
+ auto& tip{*Assert(chainman.ActiveTip())};
LogPrintf("block tree size = %u\n", chainman.BlockIndex().size());
chain_active_height = tip.nHeight;
best_block_time = tip.GetBlockTime();
@@ -1898,6 +1898,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
tip_info->header_height = chainman.m_best_header->nHeight;
tip_info->header_time = chainman.m_best_header->GetBlockTime();
}
+ scheduler.scheduleEvery([&] { (void)chainman.GetNotifications().blockTip(SynchronizationState::POST_INIT, tip); }, 5ms);
}
LogPrintf("nBestHeight = %d\n", chain_active_height);
if (node.peerman) node.peerman->SetBestBlock(chain_active_height, std::chrono::seconds{best_block_time});
|
If you ever comeback to this, please try this out: diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
--- a/src/qt/sendcoinsdialog.cpp (revision 099ae951227616a841219ea11f7fe0b6e567e047)
+++ b/src/qt/sendcoinsdialog.cpp (date 1743708385724)
@@ -142,7 +142,11 @@
this->clientModel = _clientModel;
if (_clientModel) {
- connect(_clientModel, &ClientModel::numBlocksChanged, this, &SendCoinsDialog::updateNumberOfBlocks);
+ connect(clientModel, &ClientModel::numBlocksChanged, this, &SendCoinsDialog::updateNumberOfBlocks);
+ } else { // Receiving a nullptr clientModel indicates that the app is shutting down.
+ // Disconnect signals so we don't attempt to update views during shutdown.
+ // Attempting to update them could crash the app if the methods try to fetch data from the backend models.
+ disconnect(clientModel, &ClientModel::numBlocksChanged, this, &SendCoinsDialog::updateNumberOfBlocks);
}
} Also, another possible solution could be to check for |
I've managed to reproduce the issue on v29, on my Ubuntu 22.04 it happens every time (tried it also on previous versions even with the loop but don't crash). |
During IBD, while shutting down the gui, it crashed with
Thread 1 "bitcoin-qt" received signal SIGSEGV, Segmentation fault.
Version: v29.99.0-af3dee0b8d45The
bt
is:Thus, the code seems to be:
https://github.com/bitcoin-core/gui/blob/af3dee0b8d45/src/qt/sendcoinsdialog.cpp#L850
The text was updated successfully, but these errors were encountered: