Boost logo

Boost Users :

From: Clarke, Aaron (a.clarke_at_[hidden])
Date: 2008-05-23 10:21:25


Thanks Dimitri I figured out the problem. It was a recursive function and the vector of weak_ptrs was getting edited while inside of a BOOST_FOREACH and the vector<weak_ptr<Foo> >::iterators were getting invalidated because the vectors were getting changed. Yet the weak_ptr would say that it has not expired and that the shared_ptr == true. Changing to an stl::list fixed the problem.

Weird the problem didn't show up in 1.34.1, but I imagine it eventually would have.

-Aaron

On 5/22/08 6:04 PM, "Peter Dimov" <pdimov_at_[hidden]> wrote:

Clarke, Aaron:
> Hello,
>
> I'm trying to update my codes Boost from 1.34.1 to 1.35 and I'm getting a
> test case failure dealing with weak_ptr. I have an std::vector of
> weak_ptr's and I've verified that the weak_ptr that get put in are valid.
> Then later I look through the whole vector and lock the weak_ptr's to call
> a virtual method on them. The weak_ptr says it's (!expired) and the
> (shared_ptr == true). But the vtable is all messed up and the
> shared_ptr's px is not a pointer to something I made the weak_ptr from.
>
> Soo... is there any idea about why the weak_ptr from 1.35 would do this
> when the weak_ptr from 1.34.1 works fine? The headers look remarkably the
> same so I have no idea.

Odd. Which compiler, platform? Does this happen in a small test case that
you can post?

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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