D18444: Fix crashes and freezes when Bonjour contact comes on/offLine

Jiří Paleček noreply at phabricator.kde.org
Tue Jan 22 02:16:09 GMT 2019


jpalecek created this revision.
Herald added a project: Kopete.
Herald added a subscriber: kopete-devel.
jpalecek requested review of this revision.

REVISION SUMMARY
  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
   them.
  
  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 <https://bugs.kde.org/show_bug.cgi?id=216021#c7>. Still, it is a possibility.
  
  The easiest approach is to change BonjourAccount code to use
   asynchronous versions of those calls. That way confers several
  advantages:
  
  - 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)
  
  FIXES: 216021
  FIXES: 265440
  FIXES: 301743
  FIXES: 304338

REPOSITORY
  R434 Kopete

REVISION DETAIL
  https://phabricator.kde.org/D18444

AFFECTED FILES
  protocols/bonjour/bonjouraccount.cpp
  protocols/bonjour/bonjouraccount.h

To: jpalecek
Cc: kopete-devel, himanshuvishwakarma, cochise
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kopete-devel/attachments/20190122/51d29970/attachment.html>


More information about the kopete-devel mailing list