Skip to content

Commit e9b347f

Browse files
committed
merge bitcoin-core/gui#711: Disable unused special members functions in UnlockContext
1 parent 8829549 commit e9b347f

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

src/qt/walletmodel.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -578,14 +578,6 @@ WalletModel::UnlockContext::~UnlockContext()
578578
}
579579
}
580580

581-
void WalletModel::UnlockContext::CopyFrom(UnlockContext&& rhs)
582-
{
583-
// Transfer context; old object no longer relocks wallet
584-
*this = rhs;
585-
rhs.was_locked = false;
586-
rhs.was_mixing = false;
587-
}
588-
589581
bool WalletModel::isWalletEnabled()
590582
{
591583
return !gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET);

src/qt/walletmodel.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class WalletModel : public QObject
117117
bool autoBackupWallet(QString& strBackupWarningRet, QString& strBackupErrorRet);
118118
int64_t getKeysLeftSinceAutoBackup() const;
119119

120-
// RAI object for unlocking wallet, returned by requestUnlock()
120+
// RAII object for unlocking wallet, returned by requestUnlock()
121121
class UnlockContext
122122
{
123123
public:
@@ -126,19 +126,17 @@ class WalletModel : public QObject
126126

127127
bool isValid() const { return valid; }
128128

129-
// Copy constructor is disabled.
129+
// Disable unused copy/move constructors/assignments explicitly.
130130
UnlockContext(const UnlockContext&) = delete;
131-
// Move operator and constructor transfer the context
132-
UnlockContext(UnlockContext&& obj) { CopyFrom(std::move(obj)); }
133-
UnlockContext& operator=(UnlockContext&& rhs) { CopyFrom(std::move(rhs)); return *this; }
131+
UnlockContext(UnlockContext&&) = delete;
132+
UnlockContext& operator=(const UnlockContext&) = delete;
133+
UnlockContext& operator=(UnlockContext&&) = delete;
134+
134135
private:
135136
WalletModel *wallet;
136-
bool valid;
137-
mutable bool was_locked; // mutable, as it can be set to false by copying
138-
mutable bool was_mixing; // mutable, as it can be set to false by copying
139-
140-
UnlockContext& operator=(const UnlockContext&) = default;
141-
void CopyFrom(UnlockContext&& rhs);
137+
const bool valid;
138+
const bool was_locked;
139+
const bool was_mixing;
142140
};
143141

144142
UnlockContext requestUnlock(bool fForMixingOnly = false);

0 commit comments

Comments
 (0)