Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-04-29 16:57:30


Phil Bouchard wrote:
> "Steven Watanabe" <watanabesj_at_[hidden]> wrote in message
> [...]
>> The problem is that you are manipulating the reference count
>> of a block after it is freed. The first node is deleted. The second
>> node is then deleted which decrements the reference count of the
>> first block which is already deleted.
> [...]
> Thanks for pointing this out. I dismissed this issue because it this
> situation the "back" pointer doesn't refer to the first element in the set
> list after several insertions and this creates a series of problems which
> may have a solution but better left aside for this type of problem.
> I added some code in shifted_ptr::release() which will make it disregard any
> reference count when the destructor is called upon a set deletion. Now
> everything works fine.

I'm thinking that the cleanest solution will be to have set deletion
split the
cleanup into first calling all the objects' destructors and then freeing all
the memory. When the objects are destroyed you should increment the
reference count to make sure that the objects are not destroyed again.
When you actually release the memory you can then verify that the reference
count is 1, and thus that all references to the object come from within
the set.

Otherwise, looking at your current implementation, it looks like
on the heap will never clean up the object pointed to until the set goes

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at