KMaiL: Can't setup D-Bus service. Probably already running.

Ralf Habacker ralf.habacker at freenet.de
Tue Feb 19 13:16:44 GMT 2008


Ingo Klöcker schrieb:
> On Sunday 17 February 2008, Ralf Habacker wrote:
>   
>> Thiago Macieira schrieb:
>>     
>>> Ralf Habacker wrote:
>>>       
>>>> I recognized a similar error with amarok starting the second time.
>>>> I had to restart dbus-daemon to avoid this message. In that case i
>>>> assume that the service KUniqueApplication registers in dbus
>>>> wasn't unregistered at application shutdown. At least there is no
>>>> unregisterService() call in whole kdelibs.  May be that thiago can
>>>> give some lights in this area. Anyway the related code is located
>>>> in
>>>> kdelibs/kdeui/kernel/kuniqueapplication.cpp line 146
>>>>         
>>> The name unregisters automatically when the application exits.
>>>       
>> Is this good progamming style not to unregister resources, which are
>> registered before and to expect that this unregistering is outside
>> the app ?
>>     
>
> It's irrelevant whether this is good programming style or not. It would 
> be nice if applications would unregister themselves before exiting, but 
> unregistering has to happen outside the application in any case because 
> applications will exit without unregistering for various reasons, e.g. 
> if they crash, or if they are killed, or because in some code path the 
> unregistering was forgotten.
>   
I agree as a last chance, but the dbus people suggests to unregister 
services and/or pathes when they are no more needed and not to relay on 
the tcp or unix socket connection close behavior.

If the connection is finalized (refcount reaches 0) your object path
is automatically unregistered. However, typically it's better to
unregister an object path at the point where you don't want it invoked
anymore; after all, someone else may be holding a refcount, and you
don't want the object path registration to accidentally stay alive,
especially if you freed the object it refers to.

http://lists.freedesktop.org/archives/dbus/2008-February/009328.html

This supports to unregister in the destructor of the last 
KUniqueApplication or KApplication object (may be in a static class 
method) because registering was done in the creating of the first 
KAppplication or KuniqueApplication or are I'm completly wrong ?

Ralf






More information about the kde-core-devel mailing list