[Development] Question about QCoreApplicationData::*_libpaths

Ulf Hermann ulf.hermann at theqtcompany.com
Tue Jan 5 12:56:55 CET 2016

> I was just wondering why the *_libpaths are QScopedPointer<QStringList>
> instead of just QStringList? If the answer is "lazy evaluation", a bool
> *_libpaths_inited would be preferable, if the lists can ever be empty., or
> not? The handling code is made very complicated by the use of
> QScopedPointer...

There is a difference between empty library paths and uninitialized library paths. An additional blah_inited would be a possible alternate solution. Mind, however, that the manual_libpaths are only used if you actually change the library paths with {add|remove|set}LibraryPath(). Otherwise they are never initialized. The *_libpaths members used to be plain pointers to avoid paying the price of constructing a QStringList if they are unused. That is a pretty pointless optimization and so I made them QScopedPointers, which reduced the life cycle management code. If you can reduce it even more, go ahead.


More information about the Development mailing list