Re: PATCH for lack of virtual destructor

Johannes Meyer <[email protected]> Thu, 19 Feb 2015 10:40:24 +0100
Newsgroups gmane.science.robotics.orocos.devel
Message-ID <CABowFJH7JT4qk-bQ6c642yC0s6-O5PFTQEcPA7idttvdnd8W6Q@mail.gmail.com>
On Wed, Feb 18, 2015 at 7:18 PM, Stephen Roderick <[email protected]>
 wrote:

> You were correct. Moving the destructor to the
> *OperationCallerBaseInvoker* class works.
>

Pushed to master and toolchain-2.8:
https://github.com/orocos-toolchain/rtt/commit/abb8ecee57a5e81e6c99fdd91e9f22ef32ab7051

Johannes



On Tue, Feb 17, 2015 at 10:07 PM, Johannes Meyer <[email protected]>
wrote:

> 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
>



-- 
Johannes Meyer, Senior Application Engineer
+32 468 139828
Intermodalics - Kapeldreef 60, 3001 Heverlee - BELGIUM
www.intermodalics.eu

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