The code of the BonjourAccount class in Kopete uses synchronous
(blocking) forms of the KDNSSD functions, which is a bad thing. It
would be bad enough in itself, however, in case of these functions it
is even worse because these execute an event loop inside them, which
can itself invoke slots of bonjourAccount, possibly invoking
something non-reentrant, like the disconnect code that deletes KDNSSD
objects (whose functions may still be running up in the call
chain). This can be seen in the backtraces of bugs 216021 265440
301743 304338. You can see the functions
(ie. ServiceBrowserPrivate::gotRemoveService) several times in
Moreover these nested calls can freeze the GUI.
I considered making KDNSSD more robust, since it's the KDNSSD code
that usually crashes, but that would still mean the (possibly)
non-reentrant code of Kopete could run nested so this couldn't help
much. This is describe in
comment in Bugzilla. Still, it is a possibility.
The easiest approach is to change BonjourAccount code to use
asynchronous versions of those calls. That way confers several
- no nested event loops
- no GUI freezes
- safe against deletion of the objects involved. The signal-slot connections cease to exist when the objects in question are deleted.
- the async service resolver continues to work after the service is resolved, listening to potential changes (ie. in user name or status)