On Saturday, 14. January 2012 22:36:44 Thiago Macieira wrote:
> On Saturday, 14 de January de 2012 18.38.02, Martin Koller wrote:
> > -----------------------------------------------------------
> > This is an automatically generated e-mail. To reply, visit:
> > http://git.reviewboard.kde.org/r/103699/
> > -----------------------------------------------------------
> > 
> > Review request for kdelibs.
> > 
> > 
> > Description
> > -------
> > 
> > All KUniqueApplications issue the warning
> > QDBusConnection: session D-Bus connection created before QCoreApplication.
> > Application may misbehave. when runngin with Qt-4.8.0 (qWarning in
> > QDBusDefaultConnection ctor)
> > 
> > The patch avoids this by temporarily creating a QCoreApplication instance
> 
> If this is done before the fork, it's a REALLY BAD IDEA.

it is done after the fork (if there is a fork and not used with --nofork).

> If it's done after the fork, why is the connection created this early? I 
> might 
> have written this code, but I certainly don't remember it anymore.

According to the header doc KUniqueApplication shall be used like this:

...
   *    if (!KUniqueApplication::start()) {
   *       fprintf(stderr, "myAppName is already running!\n");
   *       return 0;
   *    }
   *    KUniqueApplication a;
   *    return a.exec();

So one of the very first things the static start() method does is to
open the session dbus, and this is before a QCoreApplication is available.

So my idea here was to create one and delete it afterwards, which should
result in the same state as before the call to tryToInitDBusConnection()

If that is a bad idea, i'd like to learn why and what can be done otherwise.
(One other workaround to get rid of the warning message would be to set up
an own message handler to discard this message, but I'd rather not do that...)

-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to