|
Boost Users : |
Subject: Re: [Boost-users] [Boost.Test] valgrind complains about invalid reads
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-11-21 14:56:23
Peter Klotz wrote:
> James Sutherland wrote:
>> Try compiling a debug version. That will give you line numbers to
>> help you track it down easier.
>> James
>
> Found the problem. It was a non virtual destructor in class test_unit.
>
> Since test_unit is the base class of test_case, test_suite and
> master_test_suite_t it needs a virtual destructor.
No. It does not. We never delete test units through pointer to test_unit.
> In deregister_test_unit() a test_unit* pointer is passed which may
> actually point to a derived class. Calling delete without a virtual
> destructor leads to undefined behavior (and makes valgrind complain).
deregister_test_unit does not cause delete command. In fact it's being
call from destructor.
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