From 73bc1b7cd2b3fb5e34f4fc5aaa6892fb1e8f2d1e Mon Sep 17 00:00:00 2001 From: practicalswift Date: Tue, 10 Apr 2018 01:08:02 +0200 Subject: Initialize editStatus and autoCompleter. Previously not initialized where defined or in constructor. --- src/qt/addresstablemodel.h | 2 +- src/qt/rpcconsole.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h index d7aeda9d8e..9b20157a81 100644 --- a/src/qt/addresstablemodel.h +++ b/src/qt/addresstablemodel.h @@ -84,7 +84,7 @@ private: WalletModel *walletModel; AddressTablePriv *priv; QStringList columns; - EditStatus editStatus; + EditStatus editStatus = OK; /** Notify listeners that data changed. */ void emitDataChanged(int index); diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index a9a60d09f1..aedee24869 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -156,7 +156,7 @@ private: QMenu *peersTableContextMenu; QMenu *banTableContextMenu; int consoleFontSize; - QCompleter *autoCompleter; + QCompleter *autoCompleter = nullptr; QThread thread; QString m_last_wallet_id; -- cgit v1.2.3 From f131872653dadafd9af8bec255dfd2bddd75a471 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Tue, 10 Apr 2018 01:23:24 +0200 Subject: Initialize non-static class members where they are defined --- src/qt/addresstablemodel.h | 4 ++-- src/qt/rpcconsole.h | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h index 9b20157a81..94e0e1edce 100644 --- a/src/qt/addresstablemodel.h +++ b/src/qt/addresstablemodel.h @@ -81,8 +81,8 @@ public: OutputType GetDefaultAddressType() const; private: - WalletModel *walletModel; - AddressTablePriv *priv; + WalletModel *walletModel = nullptr; + AddressTablePriv *priv = nullptr; QStringList columns; EditStatus editStatus = OK; diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index aedee24869..26ce2af728 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -145,17 +145,17 @@ private: }; interfaces::Node& m_node; - Ui::RPCConsole *ui; - ClientModel *clientModel; + Ui::RPCConsole *ui = nullptr; + ClientModel *clientModel = nullptr; QStringList history; - int historyPtr; + int historyPtr = 0; QString cmdBeforeBrowsing; QList cachedNodeids; - const PlatformStyle *platformStyle; - RPCTimerInterface *rpcTimerInterface; - QMenu *peersTableContextMenu; - QMenu *banTableContextMenu; - int consoleFontSize; + const PlatformStyle *platformStyle = nullptr; + RPCTimerInterface *rpcTimerInterface = nullptr; + QMenu *peersTableContextMenu = nullptr; + QMenu *banTableContextMenu = nullptr; + int consoleFontSize = 0; QCompleter *autoCompleter = nullptr; QThread thread; QString m_last_wallet_id; -- cgit v1.2.3 From 1e7813e9bbb2561eafdf89481e92411be44f887a Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 11 Apr 2018 11:56:44 +0200 Subject: Remove redundant initializations from the constructor --- src/qt/addresstablemodel.cpp | 2 +- src/qt/rpcconsole.cpp | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 1e3acd75c0..b6ecd40e81 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -159,7 +159,7 @@ public: }; AddressTableModel::AddressTableModel(WalletModel *parent) : - QAbstractTableModel(parent),walletModel(parent),priv(0) + QAbstractTableModel(parent), walletModel(parent) { columns << tr("Label") << tr("Address"); priv = new AddressTablePriv(this); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 5122bab36f..7924840d0b 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -455,12 +455,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty QWidget(parent), m_node(node), ui(new Ui::RPCConsole), - clientModel(0), - historyPtr(0), - platformStyle(_platformStyle), - peersTableContextMenu(0), - banTableContextMenu(0), - consoleFontSize(0) + platformStyle(_platformStyle) { ui->setupUi(this); QSettings settings; -- cgit v1.2.3 From 3fdc5fee1864c759bceabaa61e104f954b9d1180 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 2 May 2018 13:56:20 +0200 Subject: Make sure initialization occurs in the constructor --- src/qt/addresstablemodel.h | 2 +- src/qt/rpcconsole.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h index 94e0e1edce..0c4d585d51 100644 --- a/src/qt/addresstablemodel.h +++ b/src/qt/addresstablemodel.h @@ -81,7 +81,7 @@ public: OutputType GetDefaultAddressType() const; private: - WalletModel *walletModel = nullptr; + WalletModel* const walletModel; AddressTablePriv *priv = nullptr; QStringList columns; EditStatus editStatus = OK; diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 26ce2af728..a53c4c24f9 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -145,13 +145,13 @@ private: }; interfaces::Node& m_node; - Ui::RPCConsole *ui = nullptr; + Ui::RPCConsole* const ui; ClientModel *clientModel = nullptr; QStringList history; int historyPtr = 0; QString cmdBeforeBrowsing; QList cachedNodeids; - const PlatformStyle *platformStyle = nullptr; + const PlatformStyle* const platformStyle; RPCTimerInterface *rpcTimerInterface = nullptr; QMenu *peersTableContextMenu = nullptr; QMenu *banTableContextMenu = nullptr; -- cgit v1.2.3