LO, scan coverity 708945 (non virtual destructor in parent class)

Caolán McNamara caolanm at redhat.com
Wed Mar 12 06:04:01 PDT 2014


On Sat, 2013-12-07 at 09:17 -0800, julien2412 wrote:
> Hi,
> 
> I took a look to
> https://scan5.coverity.com:8443/reports.htm#v22002/p10276/fileInstanceId=47958646&defectInstanceId=14481124&mergedDefectId=708945
>  32class SbxVarEntry : public SbxVariableRef {
>  33public:
>  34    OUString* pAlias;
>  35    SbxVarEntry() : SbxVariableRef(), pAlias( NULL ) {}
>   
> CID 708945 (#1 of 1): Non-virtual destructor (VIRTUAL_DTOR)1.
> nonvirtual_dtor: Class SbxVarEntry has a destructor and a pointer to it is
> upcast to class SbxVariableRef which doesn't have a virtual destructor.
>  36   ~SbxVarEntry() { delete pAlias; }

The code there is a tangled knot of horror, but I kind of think that
SbxVarEntry should have-a SbxVariableRef rather than be an is-a so not
inherit from it and have a Ref member.

C.



More information about the LibreOffice mailing list