Review Request: Avoid QDBusConnection Qt warning message for each KUniqueApplication

Thiago Macieira thiago at kde.org
Sun Jan 15 12:18:58 GMT 2012


On Sunday, 15 de January de 2012 11.47.10, Martin Koller wrote:
>    *    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.

It should open a session bus connection, but not *the* 
QDBusConnection::sessionBus() connection.

I know I designed the code like that. You can't open it before because that 
would mean the file descriptor is opened in the wrong process. So where is the 
warninig coming from? Did I place the warning in the wrong object in QtDBus? 
Or is there something *else* creating that connection?

Your description still requires the QCoreApplication object to be created 
before the fork. It doesn't matter that you're going to close that open and 
open a new one after the fork: it's still a bad idea. Some Unix operations do 
not survive forks, like creation of threads. If you do that, I'm pretty sure 
QProcess will be irreparably broken.
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20120115/f2e83d2c/attachment.sig>


More information about the kde-core-devel mailing list