Accidentally exported private classes

David Faure faure at kde.org
Mon Aug 10 11:06:29 UTC 2015


On Monday 10 August 2015 11:47:43 Volker Krause wrote:
> Hi,
> 
> it turns out KF5 (and PIM, which is where I started looking into this) have 
> quite some unintentionally exported private symbols (2000+ for PIM and the KF5 
> subset used by it, I'd not entirely trust the tool yet though ;) ).
> 
> This is mainly caused by using nested private classes, those inherit the 
> visibility from their outer class:
> 
> class FOO_EXPORT Foo {
>   class Private;
> };
> 
> Foo::Private is also exported by default in this case.
> 
> This is easy to fix by explicitly hiding the private class (by adding 
> Q_DECL_HIDDEN to its declaration). 

Good catch. I assume this doesn't happen in Qt because it always says "class FooPrivate"
rather than "class Foo::Private"?
Maybe we should move towards that too, for consistency with Qt, and to reduce risks
(someone might copy "class Private;" from an existing header and forget to
copy the Q_DECL_HIDDEN).

> I've started doing this in PIM code that 
> isn't covered by BC guarantees yet. Do we also want this to be done in already 
> released frameworks, although it is technically BIC? 

Classes called "*Private" are not part of our BIC promises.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list