Boost logo

Boost Users :

Subject: Re: [Boost-users] [Intrusive] safe_link assertion with list
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-06-10 15:52:12


AMDG

Pearl Rothman wrote:
> 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.
>
>
> <snip>
> virtual void destroyMessage( Message* msg )
> {
> MessageHook hook(msg);
> m_message_list.push_back( hook );
> }
>

Boost.Intrusive expects you to manage the memory for the nodes.
When the function returns, m_message_list will be left with
a dangling pointer to hook, hence the assertion.

In Christ,
Steven Watanabe


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