On Saturday 17 November 2012 10:05:46 Thiago Macieira wrote: > The private connection should be just placing calls, never receiving > them. So it does not need to register a service. > > The parent process needs to wait for the child process to signal that it's > ready to receive the call. If I'm reading the code right, that's done by > writing a 32-bit zero to the pipe. Since that is there, I don't understand > why the call would fail.
There's a major contradiction between these two paragraphs. Let me restate the issue. There are three events: A - child registers service to DBus B - parent makes newInstance() DBus call C - child creates KApplication instance, which registers itself (as an object) to DBus A must happen before B, otherwise the call errors with "no such service". This is currently ensured by the parent-child pipe you mentionned. But A and B happen before C by virtue of the API, because A and B are in KUniqueAplication::start(), while C is in "KUniqueApplication app;" which is typically further down in main(), see kuniqueapplication API docs. However you say that A cannot happen before C because A should use QDBusConnection::sessionBus() for registering, and your warning in Qt says that sessionBus() cannot be used until a QCoreApplication instance exists, i.e. C. Your idea seems to be, doing A as part of C (i.e. register service only after QApp exists), but the API doesn't allow that. B has to be inside KUniqueApplication::start(), the code that forks and synchronizes with a pipe. Unblocking B only after C is done, would require writing to the pipe at the end of the KUniqueApplication constructor... Ugly. Well, OK, I gave it a try, see http://www.davidfaure.fr/2012/kuniqueapp_dbus.diff Is this what you had in mind? It leaves one issue though: in the case where the app is already running, KApp calls ::_exit(0) but it should write to the pipe first, see TODO in the diff. Shall I really export the pipe in kuniqueapplication.cpp and write to it there in kapplication.cpp? It's getting uglier and uglier... -- David Faure, [email protected], http://www.davidfaure.fr Working on KDE, in particular KDE Frameworks 5
signature.asc
Description: This is a digitally signed message part.
