Boost logo

Boost Users :

Subject: [Boost-users] [Intrusive] safe_link assertion with list
From: Pearl Rothman (prothman_at_[hidden])
Date: 2009-06-10 12:26:03


I am using Fedora 9, gcc 4.3.0, and boost 1.38.0.

I get the following error when calling the destroyMessage function.

boost/intrusive/detail/utilities.hpp:421: void
boost::intrusive::detail::destructor_impl(Hook&,
boost::intrusive::detail::link_dispatch<safe_link>) [with Hook =
boost::intrusive::detail::generic_hook<boost::intrusive::get_list_node_algo<void*>,
boost::intrusive::default_tag, safe_link, 1>]: Assertion `!hook.is_linked()'
failed.

class MessageHook : public boost::intrusive::list_base_hook<>{
public:
    MessageHook(Message* msg)
            : m_msg(msg) {};

    Message* GetMsg() { return m_msg; }

private:
    Message* m_msg;
};

class MessageFactory
{
public:
    MessageFactory()
    {
    }

    ~MessageFactory()
    {
    }

...

    virtual void destroyMessage( Message* msg )
    {
                MessageHook hook(msg);
                m_message_list.push_back( hook );
     }

private:
    boost::intrusive::list<stockTraderMessageHook> m_message_list;
};

Thanks



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