[Interest] qobject_cast

Thiago Macieira thiago.macieira at intel.com
Thu Apr 20 18:16:22 CEST 2017

On quinta-feira, 20 de abril de 2017 08:47:46 PDT Igor Mironchik wrote:
> > Fix it by adding a non-inline virtual destructor to Channel.
> Sure. It's just a pseudo code.

Then stop pasting pseudo-code. If you hide the problem, then you won't *see* 
the problem.

> In real code was virtual destructor and dynamic_cast and static_cast
> worked, but qobject_cast failed.
> The reason was in static linking of Channel to the application and to
> the plugin.

You violated One Definition Rule of C++. Your application has Undefined 
Behaviour. You caused this, you pay the price.

Stop violating ODR and it will work.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Interest mailing list