Boost logo

Boost Users :

From: Manuel Jung (gzahl_at_[hidden])
Date: 2007-02-14 16:39:10


Hi,

Im defining a class with a multi_index_container as base. When i construct a
instance of this class, and the multi_index_container is called, the
program crashes. It even crashes, when i dont use it as a base class.

Like this:

struct query
{
    query(unsigned int id_,
          unsigned short pr_,
          unsigned short type_,
          unsigned short status_);
    virtual ~query();
    enum estatus{WAITING=0, WORKING=1, BUFFERED=2};

    unsigned int id;
    unsigned short pr;
    unsigned short type;
    unsigned short status;

    typedef boost::shared_ptr<query> pointer;
};

struct query_rank_key:composite_key<
  query::pointer,
  member<query,unsigned short,&query::status>,
  member<query,unsigned short,&query::pr>,
  member<query,unsigned int,&query::id>

>{};

typedef multi_index_container<
  query::pointer,
  indexed_by<
    ordered_non_unique<
        query_rank_key
    #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
      ,composite_key_result_less<query_rank_key::result_type>
    #endif

>,

    ordered_unique<
        tag<tid>,member<query,unsigned int,&query::id> >

> queue_set;

class queue : public queue_set
{
public:
    queue(){};
    virtual ~queue(){};
    typedef boost::shared_ptr<queue> pointer;
};

This compiles just fine, but if i run the code i get the following backtrace
after a Sigmentation Abort.
It happens, when the queue::queue() is called. Someone a idee whats it
about? Im new to boost::multi_index, so maybe i misunderstud something?
Thank you
Manuel Jung

Ps.: boost 1.33.1, g++ 4.0

#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb7a1b770 in raise () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7a1cef3 in abort () from /lib/tls/i686/cmov/libc.so.6
#3 0xb7a14dbb in __assert_fail () from /lib/tls/i686/cmov/libc.so.6
#4 0xb7b2d591 in pthread_mutex_lock ()
from /lib/tls/i686/cmov/libpthread.so.0
#5 0x080809ab in scoped_lock (this=0xbff658f8, m=@0x80f15cc)
    at /usr/local/include/boost/detail/lwm_pthreads.hpp:72
#6 0x08080a2c in boost::multi_index::detail::safe_iterator_base::detach (
    this=0xbff659c0)
    at /usr/local/include/boost/multi_index/detail/safe_mode.hpp:202
#7 0x08080bfd in ~safe_iterator_base (this=0xbff659c0)
    at /usr/local/include/boost/multi_index/detail/safe_mode.hpp:127
#8 0x08085f9d in ~safe_iterator (this=0xbff659c0)
    at /usr/local/include/boost/multi_index/detail/safe_mode.hpp:217
#9 0x08085fc1 in ~index_iterator (this=0xbff659c0)
    at /usr/local/include/boost/multi_index/detail/index_iterator.hpp:72
#10 0x0808a7a5 in
boost::multi_index::detail::ordered_index<boost::multi_index::member<query,
unsigned int, &(query::id)>, std::less<unsigned int>,
boost::multi_index---Type <return> to continue, or q <return> to quit---

::detail::nth_layer<2, boost::shared_ptr<query>,

boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<query_r
ank_key, mpl_::na, mpl_::na>,
boost::multi_index::ordered_unique<boost::multi_index::tag<tid, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<query,
unsigned int, &(query::id)>, mpl_::na>, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na>, std::allocator<boost::shared_ptr<query> > >,
boost::mpl::v_item<tid, boost::mpl::vector0<mpl_::na>, 0>,
boost::multi_index::detail::ordered_unique_tag>::invariant_
    (this=0x80f15fc)
at /usr/local/include/boost/multi_index/ordered_index.hpp:766
#11 0x0808b2dd in boost::multi_index::detail::ordered_index<query_rank_key,
std::less<boost::multi_index::composite_key_result<boost::multi_index::compos
ite_key<boost::shared_ptr<query>, boost::multi_index::member<query, unsigned
 short, &(query::status)>, boost::multi_index::member<query, unsigned short,
 &(query::pr)>,
boost::multi_index::member<query, unsigned int, &(query::id)>,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> > >, boost::mul---Type <return> to continue, or q
<return> to quit---
ti_index::detail::nth_layer<1, boost::shared_ptr<query>,
boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<query_r
ank_key, mpl_::na, mpl_::na>,
boost::multi_index::ordered_unique<boost::multi_index::tag<tid, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<query,
unsigned int, &(query::id)>, mpl_::na>, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na>, std::allocator<boost::shared_ptr<query> > >,
boost::mpl::vector0<mpl_::na>,
boost::multi_index::detail::ordered_non_unique_tag>::invariant_ (
    this=0x80f15fc)
at /usr/local/include/boost/multi_index/ordered_index.hpp:800
#12 0x0808b314 in
boost::multi_index::multi_index_container<boost::shared_ptr<query>,
boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<query_r
ank_key, mpl_::na, mpl_::na>,
boost::multi_index::ordered_unique<boost::multi_index::tag<tid, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<query,
unsigned int, &(query::id)>, mpl_::na>, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na,---Type <return> to continue, or q <return> to
quit---
 mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
std::allocator<boost::shared_ptr<query> > >::invariant_ (this=0x80f15f4)
    at /usr/local/include/boost/multi_index_container.hpp:591
#13 0x0808b33b in
boost::multi_index::multi_index_container<boost::shared_ptr<query>,
boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<query_r
ank_key, mpl_::na, mpl_::na>,
boost::multi_index::ordered_unique<boost::multi_index::tag<tid, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<query,
unsigned int, &(query::id)>, mpl_::na>, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na>, std::allocator<boost::shared_ptr<query> > >::check_invariant_
(this=0x80f15f4)
    at /usr/local/include/boost/multi_index_container.hpp:596
#14 0x08083bab in
boost::multi_index::detail::obj_scope_guard_impl0<boost::multi_index::multi_i
ndex_container<boost::shared_ptr<query>,
 boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<query_
rank_key, mpl_::na, mpl_::na>, boost:---Type <return> to continue, or q
 <return> to quit---

:multi_index::ordered_unique<boost::multi_index::tag<tid, mpl_::na,

mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<query,
unsigned int, &(query::id)>, mpl_::na>, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na>, std::allocator<boost::shared_ptr<query> > >, void
(boost::multi_index::multi_index_container<boost::shared_ptr<query>,
boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<query_r
ank_key, mpl_::na, mpl_::na>,
boost::multi_index::ordered_unique<boost::multi_index::tag<tid, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<query,
unsigned int, &(query::id)>, mpl_::na>, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na>, std::allocator<boost::shared_ptr<query> > >::*)()
const>::execute (this=0xbff65bd4)
    at /usr/local/include/boost/multi_index/detail/scope_guard.hpp:187
#15 0x08083bd7 in
boost::multi_index::detail::scope_guard_impl_base::safe_execute<b---Type
<return> to continue, or q <return> to quit---
oost::multi_index::detail::obj_scope_guard_impl0<boost::multi_index::multi_in
dex_container<boost::shared_ptr<query>,
 boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<query_
rank_key, mpl_::na, mpl_::na>,
boost::multi_index::ordered_unique<boost::multi_index::tag<tid, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<query,
unsigned int, &(query::id)>, mpl_::na>, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na>, std::allocator<boost::shared_ptr<query> > >, void
(boost::multi_index::multi_index_container<boost::shared_ptr<query>,
boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<query_r
ank_key, mpl_::na, mpl_::na>,
boost::multi_index::ordered_unique<boost::multi_index::tag<tid, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_index::member<query,
unsigned int, &(query::id)>, mpl_::na>, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na>, std::allocator<boost::sh---Type <return> to continue, or q
<return> to quit---
ared_ptr<query> > >::*)() const> > (j=@0xbff65bd4)
    at /usr/local/include/boost/multi_index/detail/scope_guard.hpp:68
#16 0x08083bfc in ~obj_scope_guard_impl0 (this=0xbff65bd4)
    at /usr/local/include/boost/multi_index/detail/scope_guard.hpp:186
#17 0x08085f1b in multi_index_container (this=0x80f15f4,
args_list=@0xbff65c28,
    al=@0xbff65c27)
at /usr/local/include/boost/multi_index_container.hpp:162
#18 0x0808a069 in queue (this=0x80f15f0) at src/slots.h:91


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net