Boost logo

Boost Users :

Subject: Re: [Boost-users] [Intrusive] safe_link assertion with list
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-06-10 15:48:38


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.

> virtual void destroyMessage( Message* msg )
> {
> MessageHook hook(msg);
> m_message_list.push_back( hook );
> }
>
> private:
> boost::intrusive::list<stockTraderMessageHook> m_message_list;
> };

Take in care that intrusive containers don't store copies of objects but
objects themselves. So in destroyMessage "hook" is going to be destroyed
while inserted in m_message_list and that's why you get the assertion.
See documentation:

http://www.boost.org/doc/libs/1_39_0/doc/html/intrusive/intrusive_vs_nontrusive.html#intrusive.intrusive_vs_nontrusive.differences_intrusive_vs_nontrusive

Maybe you just need std::list instead of intrusive.

Best,

Ion


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