mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Fix segfault when shutdown during wallet open
If you open a wallet and send a shutdown signal during that process, the GUI will segfault due to some queued wallet events happening after the wallet controller is deleted. This is a minimal fix for those issues.
This commit is contained in:
@@ -600,10 +600,15 @@ SendCoinsEntry *SendCoinsDialog::addEntry()
|
||||
entry->clear();
|
||||
entry->setFocus();
|
||||
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->sizeHint());
|
||||
qApp->processEvents();
|
||||
QScrollBar* bar = ui->scrollArea->verticalScrollBar();
|
||||
if(bar)
|
||||
bar->setSliderPosition(bar->maximum());
|
||||
|
||||
// Scroll to the newly added entry on a QueuedConnection because Qt doesn't
|
||||
// adjust the scroll area and scrollbar immediately when the widget is added.
|
||||
// Invoking on a DirectConnection will only scroll to the second-to-last entry.
|
||||
QMetaObject::invokeMethod(ui->scrollArea, [this] {
|
||||
if (ui->scrollArea->verticalScrollBar()) {
|
||||
ui->scrollArea->verticalScrollBar()->setValue(ui->scrollArea->verticalScrollBar()->maximum());
|
||||
}
|
||||
}, Qt::QueuedConnection);
|
||||
|
||||
updateTabsAndLabels();
|
||||
return entry;
|
||||
|
||||
Reference in New Issue
Block a user