Accidentally exported private classes

Friedrich W. H. Kossebau kossebau at kde.org
Wed Aug 26 14:42:04 UTC 2015


Hi Volker and all,

Am Montag, 10. August 2015, 11:47:43 schrieb Volker Krause:
> 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). I've started doing this in PIM code that
> isn't covered by BC guarantees yet.

Has this pitfall already been noted somewhere in the KDE developer 
documentation? :) So we have a place to point to and people can learn to not 
make the same mistake.

I was about to add a hint here:
https://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++#Using_a_d-Pointer
but perhaps there is a better place for that, which at least could be linked 
from here?
Going to note it at the proposed place upcoming WE, unless someone has a 
better idea here :)

Calligra also had a lot of those nested privated classes accidentally 
exported, fixed by Q_DECL_HIDDEN for now.
But only happened due to accidentally noting this thread :) And on irc people 
had to be told the story, where a link to techbase would have been nice.

Cheers
Friedrich


More information about the Kde-frameworks-devel mailing list