[Multi-Index] crash on invariant_() violation

We've recently introduced a boost multi_index_container into our code base. Now another seemingly unrelated change triggers an invariant violation in the bmi code during a unit test. I've tried to look at what kind of invariant is checked in the code, but got lost in its intricacies... Could I please get some pointers on what I should specifically look for, and maybe what invariant violations could be triggered from (or have been in the past)? Assertion failed: invariant_(), file c:\...\boost-1.38.0-debug\boost\multi_index_container.hpp, line 683 I don't have all the details of the crash yet, but the invariant is violated either during a call to empty() on the implicit index of the container (a unique_hashed index), or a call to erase() on that same index. Note that the indices use BOOST_MULTI_INDEX_CONST_MEM_FUN on a proxy object, which extracts the indexed value on the proxy-wrapped pointer. It's quite possible our code base makes a change to one of the indexed value without notifying the bmi. Is this something that would trigger an invariant violation? (it's on my todo list to avoid having something like this happening). Any insights in troubleshooting the above would be appreciated. Thanks, --DD

Hi Dominique, ________________________________________ De: boost-users-bounces@lists.boost.org [boost-users-bounces@lists.boost.org] En nombre de Dominique Devienne [ddevienne@gmail.com] Enviado el: jueves, 02 de abril de 2009 21:53 Para: boost-users Asunto: [Boost-users] [Multi-Index] crash on invariant_() violation
We've recently introduced a boost multi_index_container into our code base.
Congratulations! Thanks for using Boost.MultiIndex.
Now another seemingly unrelated change triggers an invariant violation in the bmi code during a unit test. [...] Note that the indices use BOOST_MULTI_INDEX_CONST_MEM_FUN on a proxy object, which extracts the indexed value on the proxy-wrapped pointer. It's quite possible our code base makes a change to one of the indexed value without notifying the bmi. Is this something that would trigger an invariant violation?
This is definitely going to break the container's invariants, yes. Key modification has to be done via modify() so as to give the container a chance to reindex elements. So if you are quite sure this is happening try to remove the offending behavior; after this my bet is that the invariant assertion will go away. Otherwise please get back here. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (2)
-
Dominique Devienne
-
JOAQUIN M. LOPEZ MUÑOZ