D19514: Add support for detecting avahi crash - cleanup invalid dbus objects in that case

Jiří Paleček noreply at phabricator.kde.org
Mon Mar 4 15:01:47 GMT 2019


jpalecek added inline comments.

INLINE COMMENTS

> avahi-publicservice_p.h:42
>      PublicServicePrivate(PublicService *parent, const QString &name, const QString &type, const QString &domain, unsigned int port) :
> -        QObject(), ServiceBasePrivate(name, type, domain, QString(), port), m_published(false), m_running(false), m_group(nullptr),
> +        QObject(parent), ServiceBasePrivate(name, type, domain, QString(), port), m_published(false), m_running(false), m_group(nullptr),
>          m_server(nullptr), m_collision(false), m_parent(parent)

Initialize the QObject with the parent object to ensure deleting the Private object. In this case, the ##PublicService## object simply doesn't do it in its destructor AFAIK

> avahi_listener.cpp:28
>  {
> +    m_connection = QObject::connect(&AvahiDisconnectHandler::instance(), &AvahiDisconnectHandler::avahiDisconnected,
> +                                    [this]() {

##m_connection## is needed to manually manage the connection, because ##AvahiListener## is not a ##QObject##. It is inherited by ##QObject##s, but relying on that (and casting) would need that the ##QObject## is initialized first which would be brittle. OTOH saving the connection handle seems hassle-free.

REPOSITORY
  R272 KDNSSD

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

To: jpalecek, sitter
Cc: kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190304/7e0f0bd8/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list