Re: [Boost-bugs] [Boost C++ Libraries] #2217: serialization 1.36.0 extended_type_info exit issue(s)

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2217: serialization 1.36.0 extended_type_info exit issue(s)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-08-28 22:30:09

#2217: serialization 1.36.0 extended_type_info exit issue(s)
  Reporter: timothysc_at_[hidden] | Owner: ramey
      Type: Bugs | Status: new
 Milestone: Boost 1.37.0 | Component: serialization
   Version: Boost 1.36.0 | Severity: Problem
Resolution: | Keywords: extended_type_info

Comment(by Brandon Kohn):

 Replying to [comment:2 Ryan Mulder <rjmyst3_at_[hidden]>]:
> With MinGW 4.2.1-dw2, in a debug build, there is an assertion failure at
> File: libs\serialization\src\extended_type_info.cpp
> Line: 47
> Expression: NULL != l

 I think I have found and fixed an issue with the type_unregister and
 key_unregister functions. The problem seems to be with the removal of
 items from the multiset containing them. The items are inserted into the
 multiset via ptr and sorted on fields m_key or m_ti respectively. When the
 items are deleted from the multiset, a lower/upper bound search is
 performed to find the range of keys which contain the specified value
 (m_key, m_ti) and then subsequently the iterators on that range are
 subject to:

     detail::ktmap::iterator start = x.lower_bound(this);
     detail::ktmap::iterator end = x.upper_bound(this);
     assert(start != end);

     // remove entry in map which corresponds to this type
         if(this == *start){
     }while(++start != end);

     m_key = NULL;

 Note that it breaks after removing the first item. It then sets the key to
 NULL. This means that on subsequent compares inside the set, if there are
 other instances of this key (which are held via ptr), the value of m_key
 is NULL. Inside the key_compare there are assert statements to check that
 m_key isn't NULL... after that all hell breaks lose :D.

 The same pattern is in extended_type_info_typeid.cpp. I fixed my local
 copy by changing the loop to use:

         if(this == *start){
             start = x.erase(start);
         } else {
     }while(start != end);

 So all copies of an item with the same m_key or m_ti value are removed.
 After that everything seemed to run fine.

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:58 UTC