Skip to content

Commit 76fd7b8

Browse files
committed
[Qt] Fix segfault when launched with -disablewallet
1 parent 29ef389 commit 76fd7b8

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

src/qt/bitcoingui.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,13 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
159159
labelEncryptionIcon = new QLabel();
160160
labelConnectionsIcon = new QLabel();
161161
labelBlocksIcon = new QLabel();
162-
frameBlocksLayout->addStretch();
163-
frameBlocksLayout->addWidget(unitDisplayControl);
164-
frameBlocksLayout->addStretch();
165-
frameBlocksLayout->addWidget(labelEncryptionIcon);
162+
if(enableWallet)
163+
{
164+
frameBlocksLayout->addStretch();
165+
frameBlocksLayout->addWidget(unitDisplayControl);
166+
frameBlocksLayout->addStretch();
167+
frameBlocksLayout->addWidget(labelEncryptionIcon);
168+
}
166169
frameBlocksLayout->addStretch();
167170
frameBlocksLayout->addWidget(labelConnectionsIcon);
168171
frameBlocksLayout->addStretch();

src/qt/rpcconsole.cpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,10 @@ void RPCConsole::on_tabWidget_currentChanged(int index)
473473
{
474474
ui->lineEdit->setFocus();
475475
}
476+
else if(ui->tabWidget->widget(index) == ui->tab_peers)
477+
{
478+
initPeerTable();
479+
}
476480
}
477481

478482
void RPCConsole::on_openDebugLogfileButton_clicked()
@@ -648,29 +652,44 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *combinedStats)
648652
ui->peerBanScore->setText(tr("Fetching..."));
649653
}
650654

655+
void RPCConsole::initPeerTable()
656+
{
657+
if (!clientModel)
658+
return;
659+
660+
// peerWidget needs a resize in case the dialog has non-default geometry
661+
columnResizingFixer->stretchColumnWidth(PeerTableModel::Address);
662+
663+
// start PeerTableModel auto refresh
664+
clientModel->getPeerTableModel()->startAutoRefresh(1000);
665+
}
666+
651667
// We override the virtual resizeEvent of the QWidget to adjust tables column
652668
// sizes as the tables width is proportional to the dialogs width.
653669
void RPCConsole::resizeEvent(QResizeEvent *event)
654670
{
655671
QWidget::resizeEvent(event);
672+
673+
if (!clientModel)
674+
return;
675+
656676
columnResizingFixer->stretchColumnWidth(PeerTableModel::Address);
657677
}
658678

659679
void RPCConsole::showEvent(QShowEvent *event)
660680
{
661681
QWidget::showEvent(event);
662682

663-
// peerWidget needs a resize in case the dialog has non-default geometry
664-
columnResizingFixer->stretchColumnWidth(PeerTableModel::Address);
665-
666-
// start PeerTableModel auto refresh
667-
clientModel->getPeerTableModel()->startAutoRefresh(1000);
683+
initPeerTable();
668684
}
669685

670686
void RPCConsole::hideEvent(QHideEvent *event)
671687
{
672688
QWidget::hideEvent(event);
673689

690+
if (!clientModel)
691+
return;
692+
674693
// stop PeerTableModel auto refresh
675694
clientModel->getPeerTableModel()->stopAutoRefresh();
676695
}

src/qt/rpcconsole.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class RPCConsole: public QDialog
4747
private:
4848
/** show detailed information on ui about selected node */
4949
void updateNodeDetail(const CNodeCombinedStats *combinedStats);
50+
/** initialize peer table */
51+
void initPeerTable();
5052

5153
enum ColumnWidths
5254
{

0 commit comments

Comments
 (0)