Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Test] valgrind complains about invalid reads
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2009-12-17 00:32:48


Scott Banachowski <sbanacho <at> yahoo.com> writes:

>
>
> I agree with Peter here, the destructor for test_unit should be virtual.

'Should' is a strong statement. Do you have anything to based it on?

> I find that it is being deleted when
> test_unit* is a stored in reference counted pointer,

Where?

> and at program exit it is being deleted by calling ~test_unit().

Where do I call destructor explicitly?

> If you use a derived class (test_suite), this is leading to an error.

Where?

> Also, in the code I'm looking at (1.40.0), the test_suite class has a
> virtual destructor, but its base class test_unit does not.
> Not making the base class virtual seems to be defeating the purpose.

What purpose? The only reason that test_suite destructor is virtual is because
this class in fact is being polymorphically. It has subclass master_test_suite.

Gennadiy


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