Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Test] valgrind complains about invalid reads
From: Scott Banachowski (sbanacho_at_[hidden])
Date: 2009-12-18 18:54:18


--- Steven Watanabe wrote:

> joel falcou wrote:
> > I'm jumping in the wagon but this very piece of code
> leads to a
> > "incorrect free" on Snow Leopard using g++ 4.2.1
> Apple.
> > Maybe it is related to the virtual matter
>
> We've already discussed this many times. The code above
> is wrong for reasons unrelated to the use of a virtual
> destructor,
> although adding a virtual destructor masks the problem.
> This has been fixed in the trunk.

Thanks Steven,
with some searching I think I found the patch you are referring to:
https://svn.boost.org/trac/boost/changeset/56467

Seeing this patch, I now see how the virtual function is a red herring (although I don't know why it happens to work, in this case). Nevertheless, I still like the idea of making it virtual, just to avoid the necessity of switching on type and casting to delete, but that's my opinion.

Scott

      


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