On sexta-feira, 15 de março de 2013 06.10.37, Ilya Basin wrote:
> Hi list!
> There's such app called bluedevilmonolithic. It goes to background on
> start.
> Current code to terminate it:
>
>   void BlueDevilDaemon::monolithicQuit(QDBusPendingCallWatcher* watcher)
>   {
>     // can restart here?
>   }
>
>     QDBusMessage msg = QDBusMessage::createMethodCall(
>         "org.kde.bluedevilmonolithic",
>         "/MainApplication",
>         "org.kde.KApplication",
>         "quit"
>     );
>     QDBusPendingCall pending = QDBusConnection::sessionBus().asyncCall(msg);
> QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending);
> connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
> SLOT(monolithicQuit(QDBusPendingCallWatcher*)));
>
> Is it too soon to try starting a new instance in monolithicQuit() ?

Yes.

> I don't see a call to QDBusConnectionInterface::unregisterService() in
> kuniqueapplication.cpp. Does it mean that it unregisters only when the
> process dies?

Yes.

Use QDBusServiceWatcher to find out when the name unregisters. You do not need
to wait for the reply to the method call in that case. Just send() it instead
of using asyncCall().

--
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

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

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to