Re: PATCH for lack of virtual destructor

Johannes Meyer <[email protected]> Tue, 17 Feb 2015 22:07:07 +0100
Newsgroups gmane.science.robotics.orocos.devel
Message-ID <CABowFJHGMyecHz0pMa3TZ0YpZXDSMmRK+H_6sfuJL9p8q2CR_Q@mail.gmail.com>
Hi Stephen,


On Tue, Feb 17, 2015 at 7:23 PM, S Roderick <[email protected]> wrote:

> OperationCaller has virtual functions but not a virtual destructor, which
> leads to compile errors with certain compilers and options.
>

The class OperationCaller itself does not have virtual methods and I could
not find any other class in RTT that inherits from OperationCaller. The
virtual destructor would only be required if an instance of a subclass of
OperationCaller was deleted from an OperationCaller pointer. Of course it
does not hurt to have one...

OperationCallerBaseInvoker is an abstract base class of OperationCaller
with only virtual methods and should therefore have a virtual destructor
instead, if instances are ever deleted from an OperationCallerBaseInvoker
pointer. I don't see where this would happen within RTT, but it is more
likely because ServiceRequester::getOperationCaller() returns a
OperationCallerBaseInvoker pointer. Could you please try if adding the
destructor to OperationCallerBaseInvoker instead also fixes your compiler
error? This would automatically cause the implicit OperationCaller
destructor to be virtual, too.


S
>
>
Johannes

-- 
Orocos-Dev mailing list
[email protected]
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev