[Development] QtMultimedia BIC / header cleanliness issue

Sze Howe Koh szehowe.koh at gmail.com
Sun Dec 23 04:50:18 CET 2012

On 23 December 2012 06:20, Thiago Macieira <thiago.macieira at intel.com> wrote:
> Hello
> Now that Qt 5.0 is out, I've been doing some clean up tasks I had been putting
> off. One of them, to properly do the headersclean test, turned up that
> QtMultimedia did not have this test at all. And here's what it produces:
> multimedia/qmediaserviceproviderplugin.h:111:28: error: ‘struct
> QMediaServiceProviderFactoryInterface’ has virtual functions and accessible
> non-virtual destructor [-Werror=non-virtual-dtor]
> audio/qaudiosystemplugin.h:63:28: error: ‘struct QAudioSystemFactoryInterface’
> has virtual functions and accessible non-virtual destructor [-Werror=non-
> virtual-dtor]
> Clearly those two classes cannot be used for deletion. Is that normal? What
> are those classes used for, anyway?
> Note that those two classes are exported, but they don't have any out-of-line
> virtuals. For QAudioSystemFactoryInterface, the virtual table is emitted in
> the library but there isn't one for QMediaServiceProviderFactoryInterface.\
> Any suggestions on what to do?
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center

Those interface classes originate from Qt Mobility. I'm guessing that
the lack of virtual destructors was an old oversight -- other
interfaces (e.g. QMediaServiceSupportedDevicesInterface in
qmediaserviceproviderplugin.h) do have empty virtual destructors.

For consistency with the other interfaces, I suggest simply adding
empty virtual destructors. I believe this won't break any existing
code; the only code that should be affected is deletion via pointers
to QMediaServiceProviderFactoryInterface/QAudioSystemFactoryInterface.
But in this case, our change would probably fix memory leaks for
programs which use such code.

P.S. Slightly off-tangent, but I've been unsuccessful in getting an
answer so far: Do we still have a maintainer for Qt Multimedia?

More information about the Development mailing list