File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
10
10
11
11
### Changed
12
12
- Change 266 files from CRLF to LF.
13
+ - Apply "rule of three" to Client copy constructor and copy assignment operator
13
14
14
15
### Deprecated
15
16
Original file line number Diff line number Diff line change @@ -13,16 +13,18 @@ class Client : public Stream {
13
13
}
14
14
Client (const Client &client) { // copy constructor
15
15
if (this != &client) { // not a self-assignment
16
- if (mGodmodeDataIn ) { // replace what we previously had
17
- delete mGodmodeDataIn ; // get rid of previous value
16
+ if (mGodmodeDataIn &&
17
+ client.mGodmodeDataIn ) { // replace what we previously had
18
+ delete mGodmodeDataIn ; // get rid of previous value
18
19
mGodmodeDataIn = new String (client.mGodmodeDataIn ->c_str ());
19
20
}
20
21
}
21
22
}
22
23
Client &operator =(const Client &client) { // copy assignment operator
23
24
if (this != &client) { // not a self-assignment
24
- if (mGodmodeDataIn ) { // replace what we previously had
25
- delete mGodmodeDataIn ; // get rid of previous value
25
+ if (mGodmodeDataIn &&
26
+ client.mGodmodeDataIn ) { // replace what we previously had
27
+ delete mGodmodeDataIn ; // get rid of previous value
26
28
mGodmodeDataIn = new String (client.mGodmodeDataIn ->c_str ());
27
29
}
28
30
}
You can’t perform that action at this time.
0 commit comments