Skip to content

Commit

Permalink
Delete operator=(Self&) when copy constructor is deleted (#8535)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulocsanz committed Apr 11, 2022
1 parent 684156d commit 27827c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions libraries/ESP8266WiFi/src/BearSSLHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class PublicKey {

// Disable the copy constructor, we're pointer based
PublicKey(const PublicKey& that) = delete;
PublicKey& operator=(const PublicKey& that) = delete;

private:
brssl::public_key *_key;
Expand Down Expand Up @@ -86,6 +87,7 @@ class PrivateKey {

// Disable the copy constructor, we're pointer based
PrivateKey(const PrivateKey& that) = delete;
PrivateKey& operator=(const PrivateKey& that) = delete;

private:
brssl::private_key *_key;
Expand Down Expand Up @@ -122,6 +124,7 @@ class X509List {

// Disable the copy constructor, we're pointer based
X509List(const X509List& that) = delete;
X509List& operator=(const X509List& that) = delete;

private:
size_t _count;
Expand Down
4 changes: 2 additions & 2 deletions libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace BearSSL {
class WiFiClientSecureCtx : public WiFiClient {
public:
WiFiClientSecureCtx();
WiFiClientSecureCtx(const WiFiClientSecure &rhs) = delete;
WiFiClientSecureCtx(const WiFiClientSecureCtx &rhs) = delete;
~WiFiClientSecureCtx() override;

WiFiClientSecureCtx& operator=(const WiFiClientSecureCtx&) = delete;
Expand All @@ -43,7 +43,7 @@ class WiFiClientSecureCtx : public WiFiClient {
// TODO: don't remove just yet to avoid including the WiFiClient default implementation and unintentionally causing
// a 'slice' that this method tries to avoid in the first place
std::unique_ptr<WiFiClient> clone() const override {
return std::unique_ptr<WiFiClient>(new WiFiClientSecureCtx(*this));
return nullptr;
}

int connect(IPAddress ip, uint16_t port) override;
Expand Down

0 comments on commit 27827c8

Please sign in to comment.