Browse Source

[Qt] Fix segfault when launched with -disablewallet

pull/1/head
Cozz Lovan 8 years ago
parent
commit
76fd7b8c26
  1. 11
      src/qt/bitcoingui.cpp
  2. 29
      src/qt/rpcconsole.cpp
  3. 2
      src/qt/rpcconsole.h

11
src/qt/bitcoingui.cpp

@ -159,10 +159,13 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) : @@ -159,10 +159,13 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
labelEncryptionIcon = new QLabel();
labelConnectionsIcon = new QLabel();
labelBlocksIcon = new QLabel();
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(unitDisplayControl);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelEncryptionIcon);
if(enableWallet)
{
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(unitDisplayControl);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelEncryptionIcon);
}
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelConnectionsIcon);
frameBlocksLayout->addStretch();

29
src/qt/rpcconsole.cpp

@ -473,6 +473,10 @@ void RPCConsole::on_tabWidget_currentChanged(int index) @@ -473,6 +473,10 @@ void RPCConsole::on_tabWidget_currentChanged(int index)
{
ui->lineEdit->setFocus();
}
else if(ui->tabWidget->widget(index) == ui->tab_peers)
{
initPeerTable();
}
}
void RPCConsole::on_openDebugLogfileButton_clicked()
@ -648,11 +652,27 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *combinedStats) @@ -648,11 +652,27 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *combinedStats)
ui->peerBanScore->setText(tr("Fetching..."));
}
void RPCConsole::initPeerTable()
{
if (!clientModel)
return;
// peerWidget needs a resize in case the dialog has non-default geometry
columnResizingFixer->stretchColumnWidth(PeerTableModel::Address);
// start PeerTableModel auto refresh
clientModel->getPeerTableModel()->startAutoRefresh(1000);
}
// We override the virtual resizeEvent of the QWidget to adjust tables column
// sizes as the tables width is proportional to the dialogs width.
void RPCConsole::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
if (!clientModel)
return;
columnResizingFixer->stretchColumnWidth(PeerTableModel::Address);
}
@ -660,17 +680,16 @@ void RPCConsole::showEvent(QShowEvent *event) @@ -660,17 +680,16 @@ void RPCConsole::showEvent(QShowEvent *event)
{
QWidget::showEvent(event);
// peerWidget needs a resize in case the dialog has non-default geometry
columnResizingFixer->stretchColumnWidth(PeerTableModel::Address);
// start PeerTableModel auto refresh
clientModel->getPeerTableModel()->startAutoRefresh(1000);
initPeerTable();
}
void RPCConsole::hideEvent(QHideEvent *event)
{
QWidget::hideEvent(event);
if (!clientModel)
return;
// stop PeerTableModel auto refresh
clientModel->getPeerTableModel()->stopAutoRefresh();
}

2
src/qt/rpcconsole.h

@ -47,6 +47,8 @@ protected: @@ -47,6 +47,8 @@ protected:
private:
/** show detailed information on ui about selected node */
void updateNodeDetail(const CNodeCombinedStats *combinedStats);
/** initialize peer table */
void initPeerTable();
enum ColumnWidths
{

Loading…
Cancel
Save