Boost logo

Boost Users :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2008-05-20 00:18:19


Julie Larson wrote:
> Hello,
>
> I'm using boost 1.35.0 and found this sample code about the hash set
> functionality:
>
> http://www.boost.org/doc/libs/1_35_0/doc/html/intrusive/advanced_lookups_insertions.html
>
> and modified it as shown below. I find that when iterating through
> the hash table, the thing crashes here (where the get_next function
> contains an invalid value for n):

As Steven mentioned, executing this code:

> BOOST_FOREACH( CWord& w, m_hWords )
> {
> CWord* pWord = &w;
> delete pWord;
> }

in my windows (32 bit) machine raises an assertion (safe hook assertion)
in the destructor of the hook (called by CWord's destructor) because you
are deleting an object that is still inserted in an intrusive container.
Since the container uses the hook to link objects, if we delete the
object before erasing it from the container the container tries to
access to unallocated memory.

I know you get an error in another place, but just for information. Can
you give me which compiler/platform are you using?

Regards,

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