[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: How to gracefully kill a KUniqueApplication and wait for its termination?
From:       Thiago Macieira <thiago () kde ! org>
Date:       2013-03-15 7:16:28
Message-ID: 1774858.ScNBijb1Lf () tjmaciei-mobl2
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


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

["signature.asc" (application/pgp-signature)]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic