move QCoreApplication::addLibraryPath call from KApplication to KComponentData

Matthias Kretz kretz at
Mon Nov 10 13:46:14 GMT 2008

On Monday 10 November 2008 12:07:59 Thiago Macieira wrote:
> On Monday 10 November 2008 10:05:30 Matthias Kretz wrote:
> > Hi,
> >
> > please review the attached patch. It makes the first KCD ensure that Qt
> > knows about KDE's Qt plugin paths. This is necessary for non-KDE sessions
> > where a KDE application that is not using KApplication is started.
> That means any non-KDE Qt application that loads a KDE plugin (such as
> Oxygen) will get this code run. I don't know if this was your intention,
> but I felt I needed to point out.

Yes, that was my intention. And BTW if a Qt-only app manages to load Oxygen 
then it already has the KDE plugin path in its libraryPath.

> Also, the initialisation the way you did it with QBasicAtomicInt isn't
> thread- safe. You may as well use a simple boolean.

why? I thought


void someFunction()
  if (flag.testAndSetOrdered(0, 1)) {
    // this is only reached once

If testAndSet is atomic (I don't even see the need for the memory barrier) 
there's only one thread that can return true from the testAndSet call...

> What you're looking for is the Q_ONCE code that I have not added yet to Qt.

Matthias Kretz (Germany)                            <><

More information about the kde-core-devel mailing list