Ошибка сегментации boost :: ptr_vector при удалении (munmap_chunk ())

Я использую boost :: ptr_vector, чтобы содержать список объектов класса.

Я добавляю объекты в ptr_vector следующим образом:

parent_ptrvector.push_back(new PlanVertex(-1,-1,-1));

Я добавляю объекты только один раз, когда класс, содержащий ptr_vector, инициализируется.

Я никогда не копирую вектор.

Я не добавляю и не удаляю объекты из вектора, но вызываю функцию setCoords для элементов в ptr_vector следующим образом:

parent_ptrvector.at(i).setCoords(1,2,3);

Моя проблема в том, что я, кажется, периодически получаю ошибку сегментации, когда класс, содержащий ptr_vector, разрушается. Кажется, что ошибка более вероятна, когда я вызвал setCoords для многих различных элементов во время выполнения.

Я получаю сообщение:

munmap_chunk(): invalid pointer: 0x00007fff50016f20 ***

Большое спасибо за любую помощь, я вставил ниже трассировку GDB:

#0  0x00007ffff5d6f425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff5d72b8b in __GI_abort () at abort.c:91
#2  0x00007ffff5dad39e in __libc_message (do_abort=2, fmt=0x7ffff5eb7748 "*** glibc detected *** %s: %s: 0x%s ***\n") at ../sysdeps/unix/sysv/linux/libc_fatal.c:201
#3  0x00007ffff5db7b96 in malloc_printerr (action=3, str=0x7ffff5eb7838 "munmap_chunk(): invalid pointer", ptr=<optimized out>) at malloc.c:5039
#4  0x00000000004cbf8d in void boost::checked_delete<PlanVertex const>(PlanVertex const*) ()
#5  0x00000000004cbf55 in void boost::delete_clone<PlanVertex>(PlanVertex const*) ()
#6  0x00000000004cbf35 in void boost::heap_clone_allocator::deallocate_clone<PlanVertex>(PlanVertex const*) ()
#7  0x00000000004cbf15 in boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<PlanVertex, std::vector<void*, std::allocator<void*> > >, boost::heap_clone_allocator>::null_clone_allocator<false>::deallocate_clone(PlanVertex const*) ()
#8  0x00000000004cbeb5 in boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<PlanVertex, std::vector<void*, std::allocator<void*> > >, boost::heap_clone_allocator>::null_policy_deallocate_clone(PlanVertex const*) ()
#9  0x00000000004cbe69 in void boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<PlanVertex, std::vector<void*, std::allocator<void*> > >, boost::heap_clone_allocator>::remove<boost::void_ptr_iterator<__gnu_cxx::__normal_iterator<void**, std::vector<void*, std::allocator<void*> > >, PlanVertex> >(boost::void_ptr_iterator<__gnu_cxx::__normal_iterator<void**, std::vector<void*, std::allocator<void*> > >, PlanVertex>) ()
#10 0x00000000004cbd1b in void boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<PlanVertex, std::vector<void*, std::allocator<void*> > >, boost::heap_clone_allocator>::remove<boost::void_ptr_iterator<__gnu_cxx::__normal_iterator<void**, std::vector<void*, std::allocator<void*> > >, PlanVertex> >(boost::void_ptr_iterator<__gnu_cxx::__normal_iterator<void**, std::vector<void*, std::allocator<void*> > >, PlanVertex>, boost::void_ptr_iterator<__gnu_cxx::__normal_iterator<void**, std::vector<void*, std::allocator<void*> > >, PlanVertex>) ()
#11 0x00000000004cbcbb in boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<PlanVertex, std::vector<void*, std::allocator<void*> > >, boost::heap_clone_allocator>::remove_all() ()
#12 0x00000000004cbc38 in boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<PlanVertex, std::vector<void*, std::allocator<void*> > >, boost::heap_clone_allocator>::~reversible_ptr_container() ()
#13 0x00000000004cbc15 in boost::ptr_sequence_adapter<PlanVertex, std::vector<void*, std::allocator<void*> >, boost::heap_clone_allocator>::~ptr_sequence_adapter() ()
#14 0x00000000004cbbf5 in boost::ptr_vector<PlanVertex, boost::heap_clone_allocator, std::allocator<void*> >::~ptr_vector() ()
#15 0x00000000004cbbd5 in boost::ptr_vector<PlanVertex, boost::heap_clone_allocator, std::allocator<void*> >::~ptr_vector() ()
#16 0x00000000004cb8ec in PathPlanData::~PathPlanData() ()
#17 0x00000000004cb825 in PathPlanData::~PathPlanData() ()

1

Решение

Задача ещё не решена.

Другие решения


По вопросам рекламы ammmcru@yandex.ru
Adblock
detector