projects
/
folly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2aad5a9
)
fix IOBuf self move-assignment
author
Philip Pronin
<philipp@fb.com>
Tue, 6 May 2014 22:53:39 +0000
(15:53 -0700)
committer
Dave Watson
<davejwatson@fb.com>
Tue, 20 May 2014 19:53:58 +0000
(12:53 -0700)
Summary: Properly handle `this == &other` case.
Test Plan: fbconfig -r folly/test && fbmake runtests_opt -j32
Reviewed By: simpkins@fb.com
FB internal diff:
D1314916
folly/io/IOBuf.cpp
patch
|
blob
|
history
diff --git
a/folly/io/IOBuf.cpp
b/folly/io/IOBuf.cpp
index f8a34fd06abdc0c7714c9e7360d738d24f3c6704..28a41be5c92975f50e6f7aa203cb626b40b27801 100644
(file)
--- a/
folly/io/IOBuf.cpp
+++ b/
folly/io/IOBuf.cpp
@@
-365,6
+365,10
@@
IOBuf::~IOBuf() {
}
IOBuf& IOBuf::operator=(IOBuf&& other) noexcept {
+ if (this == &other) {
+ return *this;
+ }
+
// If we are part of a chain, delete the rest of the chain.
while (next_ != this) {
// Since unlink() returns unique_ptr() and we don't store it,