Fixes Trac #12296 ("boost::container::{deque,string} combine for a memory leak"). The use of trivial_destructor_after_move was incorrect in several contexts.

This commit is contained in:
Ion Gaztañaga
2016-08-02 00:49:38 +02:00
parent 225e2da77e
commit 649aba461e
2 changed files with 5 additions and 7 deletions

View File

@@ -1220,7 +1220,8 @@ use [*Boost.Container]? There are several reasons for that:
* [@https://svn.boost.org/trac/boost/ticket/12177 Trac #12177: ['"vector::priv_merge uses unqualified uintptr_t"]].
* [@https://svn.boost.org/trac/boost/ticket/12183 Trac #12183: ['"GCC 6.1 thinks boost::container::string violates strict aliasing"]].
* [@https://svn.boost.org/trac/boost/ticket/12286 Trac #12286: ['"PMR flat_map from Boost Container does not compile"]].
* [@https://svn.boost.org/trac/boost/ticket/12286 Trac #12319: ['"boost::container::flat_set` should be nothrow move constructible"]].
* [@https://svn.boost.org/trac/boost/ticket/12296 Trac #12296: ['"boost::container::{deque,string} combine for a memory leak"]].
* [@https://svn.boost.org/trac/boost/ticket/12319 Trac #12319: ['"boost::container::flat_set` should be nothrow move constructible"]].
* Revised noexcept expressions of default and move constructors in all containers.

View File

@@ -1711,7 +1711,6 @@ class deque : protected deque_base<Allocator>
if (elems_before < (this->size() - n) - elems_before) {
boost::container::move_backward(begin(), first.unconst(), last.unconst());
iterator new_start = this->members_.m_start + n;
if(!Base::traits_t::trivial_dctr_after_move)
this->priv_destroy_range(this->members_.m_start, new_start);
this->priv_destroy_nodes(this->members_.m_start.m_node, new_start.m_node);
this->members_.m_start = new_start;
@@ -1719,7 +1718,6 @@ class deque : protected deque_base<Allocator>
else {
boost::container::move(last.unconst(), end(), first.unconst());
iterator new_finish = this->members_.m_finish - n;
if(!Base::traits_t::trivial_dctr_after_move)
this->priv_destroy_range(new_finish, this->members_.m_finish);
this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1);
this->members_.m_finish = new_finish;
@@ -1827,7 +1825,6 @@ class deque : protected deque_base<Allocator>
}
else {
iterator new_finish = this->members_.m_finish - n;
if(!Base::traits_t::trivial_dctr_after_move)
this->priv_destroy_range(new_finish, this->members_.m_finish);
this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1);
this->members_.m_finish = new_finish;