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

Reply via email to