Fix BufferSlice self-move.

GitOrigin-RevId: 904ea326cc860dd92c49d319fc5fabde22a35223
This commit is contained in:
levlam 2020-08-11 07:23:25 +03:00
parent 14014e3f3d
commit b6c915c2f8
2 changed files with 5 additions and 0 deletions

View File

@ -122,6 +122,9 @@ class BufferSlice {
debug_untrack(); // yes, debug_untrack
}
BufferSlice &operator=(BufferSlice &&other) {
if (this == &other) {
return *this;
}
debug_untrack();
buffer_ = std::move(other.buffer_);
begin_ = other.begin_;

View File

@ -137,6 +137,8 @@ TEST(Http, reader) {
{
BufferSlice a("test test");
BufferSlice b = std::move(a);
a = std::move(a);
b = std::move(b);
a = std::move(b);
BufferSlice c = a.from_slice(a);
CHECK(c.size() == a.size());