Fix BufferSlice self-move.
GitOrigin-RevId: 904ea326cc860dd92c49d319fc5fabde22a35223
This commit is contained in:
parent
14014e3f3d
commit
b6c915c2f8
@ -122,6 +122,9 @@ class BufferSlice {
|
|||||||
debug_untrack(); // yes, debug_untrack
|
debug_untrack(); // yes, debug_untrack
|
||||||
}
|
}
|
||||||
BufferSlice &operator=(BufferSlice &&other) {
|
BufferSlice &operator=(BufferSlice &&other) {
|
||||||
|
if (this == &other) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
debug_untrack();
|
debug_untrack();
|
||||||
buffer_ = std::move(other.buffer_);
|
buffer_ = std::move(other.buffer_);
|
||||||
begin_ = other.begin_;
|
begin_ = other.begin_;
|
||||||
|
@ -137,6 +137,8 @@ TEST(Http, reader) {
|
|||||||
{
|
{
|
||||||
BufferSlice a("test test");
|
BufferSlice a("test test");
|
||||||
BufferSlice b = std::move(a);
|
BufferSlice b = std::move(a);
|
||||||
|
a = std::move(a);
|
||||||
|
b = std::move(b);
|
||||||
a = std::move(b);
|
a = std::move(b);
|
||||||
BufferSlice c = a.from_slice(a);
|
BufferSlice c = a.from_slice(a);
|
||||||
CHECK(c.size() == a.size());
|
CHECK(c.size() == a.size());
|
||||||
|
Loading…
Reference in New Issue
Block a user