Fix moving ostream while holding data
This commit is contained in:
parent
291b0075bb
commit
b77d2a8c85
@ -396,8 +396,10 @@ class ostream final : private detail::buffer<char> {
|
|||||||
ostream(ostream&& other)
|
ostream(ostream&& other)
|
||||||
: detail::buffer<char>(other.data(), other.size(), other.capacity()),
|
: detail::buffer<char>(other.data(), other.size(), other.capacity()),
|
||||||
file_(std::move(other.file_)) {
|
file_(std::move(other.file_)) {
|
||||||
|
other.clear();
|
||||||
other.set(nullptr, 0);
|
other.set(nullptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
~ostream() {
|
~ostream() {
|
||||||
flush();
|
flush();
|
||||||
delete[] data();
|
delete[] data();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user