Skip to content

Commit ef006d9

Browse files
committed
Merge #12928: qt: Initialize non-static class members that were previously neither initialized where defined nor in constructor
3fdc5fe Make sure initialization occurs in the constructor (practicalswift) 1e7813e Remove redundant initializations from the constructor (practicalswift) f131872 Initialize non-static class members where they are defined (practicalswift) 73bc1b7 Initialize editStatus and autoCompleter. Previously not initialized where defined or in constructor. (practicalswift) Pull request description: Initialize variables previously neither defined where defined nor in constructor: * `editStatus` * `autoCompleter` Also; initialize non-static class members where they are defined in accordance with developer notes. Tree-SHA512: 84f0cb87ec8394ed7641bfa0731be2ec72e6a920e00ae206ff89e2e7c960358f603c52878311b24601a33aa7cba6ea4f9a78a8ade88112dea0f41efb08e84e25
2 parents ef46c99 + 3fdc5fe commit ef006d9

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

src/qt/addresstablemodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class AddressTablePriv
159159
};
160160

161161
AddressTableModel::AddressTableModel(WalletModel *parent) :
162-
QAbstractTableModel(parent),walletModel(parent),priv(0)
162+
QAbstractTableModel(parent), walletModel(parent)
163163
{
164164
columns << tr("Label") << tr("Address");
165165
priv = new AddressTablePriv(this);

src/qt/addresstablemodel.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ class AddressTableModel : public QAbstractTableModel
8383
OutputType GetDefaultAddressType() const;
8484

8585
private:
86-
WalletModel *walletModel;
87-
AddressTablePriv *priv;
86+
WalletModel* const walletModel;
87+
AddressTablePriv *priv = nullptr;
8888
QStringList columns;
89-
EditStatus editStatus;
89+
EditStatus editStatus = OK;
9090

9191
/** Look up address book data given an address string. */
9292
bool getAddressData(const QString &address, std::string* name, std::string* purpose) const;

src/qt/rpcconsole.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,12 +455,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
455455
QWidget(parent),
456456
m_node(node),
457457
ui(new Ui::RPCConsole),
458-
clientModel(0),
459-
historyPtr(0),
460-
platformStyle(_platformStyle),
461-
peersTableContextMenu(0),
462-
banTableContextMenu(0),
463-
consoleFontSize(0)
458+
platformStyle(_platformStyle)
464459
{
465460
ui->setupUi(this);
466461
QSettings settings;

src/qt/rpcconsole.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,18 @@ public Q_SLOTS:
145145
};
146146

147147
interfaces::Node& m_node;
148-
Ui::RPCConsole *ui;
149-
ClientModel *clientModel;
148+
Ui::RPCConsole* const ui;
149+
ClientModel *clientModel = nullptr;
150150
QStringList history;
151-
int historyPtr;
151+
int historyPtr = 0;
152152
QString cmdBeforeBrowsing;
153153
QList<NodeId> cachedNodeids;
154-
const PlatformStyle *platformStyle;
155-
RPCTimerInterface *rpcTimerInterface;
156-
QMenu *peersTableContextMenu;
157-
QMenu *banTableContextMenu;
158-
int consoleFontSize;
159-
QCompleter *autoCompleter;
154+
const PlatformStyle* const platformStyle;
155+
RPCTimerInterface *rpcTimerInterface = nullptr;
156+
QMenu *peersTableContextMenu = nullptr;
157+
QMenu *banTableContextMenu = nullptr;
158+
int consoleFontSize = 0;
159+
QCompleter *autoCompleter = nullptr;
160160
QThread thread;
161161
QString m_last_wallet_id;
162162

0 commit comments

Comments
 (0)