]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/serialization/src/extended_type_info_typeid.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / serialization / src / extended_type_info_typeid.cpp
index 5669dfa7727c4f504ce7c5316b15c07a3e6ec3bc..7413d2e3a401dcce30b25b7381006c321e439174 100644 (file)
@@ -95,19 +95,18 @@ BOOST_SERIALIZATION_DECL void
 extended_type_info_typeid_0::type_unregister()
 {
     if(NULL != m_ti){
+        BOOST_ASSERT(! singleton<tkmap>::is_destroyed());
         if(! singleton<tkmap>::is_destroyed()){
             tkmap & x = singleton<tkmap>::get_mutable_instance();
-            tkmap::iterator start = x.lower_bound(this);
-            tkmap::iterator end = x.upper_bound(this);
-            BOOST_ASSERT(start != end);
-
-            // remove entry in map which corresponds to this type
-            do{
-            if(this == *start)
-                x.erase(start++);
-            else
-                ++start;
-            }while(start != end);
+
+            // remove all entries in map which corresponds to this type
+            // make sure that we don't use any invalidated iterators
+            for(;;){
+                const tkmap::iterator & it = x.find(this);
+                if(it == x.end())
+                    break;
+                x.erase(it);
+            };
         }
     }
     m_ti = NULL;