[neon/kde/kdnssd/Neon/release] debian/patches: patch recommended by author

Jonathan Riddell null at kde.org
Mon Feb 15 18:27:39 GMT 2021


Git commit f74bd5245daf82a437af9fd8c3c31b558976d064 by Jonathan Riddell.
Committed on 15/02/2021 at 18:27.
Pushed by jriddell into branch 'Neon/release'.

patch recommended by author

A  +433  -0    debian/patches/8c14803908a2a718fa0716fb98506aebda1fed46.diff
A  +1    -0    debian/patches/series

https://invent.kde.org/neon/kde/kdnssd/commit/f74bd5245daf82a437af9fd8c3c31b558976d064

diff --git a/debian/patches/8c14803908a2a718fa0716fb98506aebda1fed46.diff b/debian/patches/8c14803908a2a718fa0716fb98506aebda1fed46.diff
new file mode 100644
index 0000000..df23db0
--- /dev/null
+++ b/debian/patches/8c14803908a2a718fa0716fb98506aebda1fed46.diff
@@ -0,0 +1,433 @@
+commit 8c14803908a2a718fa0716fb98506aebda1fed46
+Author: Friedrich W. H. Kossebau <kossebau at kde.org>
+Date:   Sun Feb 14 22:52:48 2021 +0100
+
+    Revert "Switch from custom K_D to Q_DECLARE_PRIVATE_D & Q_D"
+    
+    Q_DECLARE_PRIVATE_D uses reinterpret_cast with the d member in the
+    defined methods, which results in bad casting with the multi-inheritance
+    subclasses of ServiceBasePrivate.
+    
+    Switch to use KDNSSD_D instead of K_D to reduce risk of potential clashes.
+    
+    This reverts commit e8f082950a2fcb7b148a1ac568eda9400145da5d.
+    
+    BUG: 432949
+
+diff --git a/src/avahi-publicservice.cpp b/src/avahi-publicservice.cpp
+index 7fdfde4..e32b8b8 100644
+--- a/src/avahi-publicservice.cpp
++++ b/src/avahi-publicservice.cpp
+@@ -28,7 +28,7 @@ PublicService::PublicService(const QString &name, const QString &type, unsigned
+                              const QString &domain, const QStringList &subtypes)
+     : QObject(), ServiceBase(new PublicServicePrivate(this, name, type, domain, port))
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     if (domain.isNull()) {
+         d->m_domain = "local.";
+     }
+@@ -62,7 +62,7 @@ void PublicServicePrivate::gotGlobalStateChanged(int state,
+ 
+ void PublicService::setServiceName(const QString &serviceName)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_serviceName = serviceName;
+     if (d->m_running) {
+         d->m_group->Reset();
+@@ -72,7 +72,7 @@ void PublicService::setServiceName(const QString &serviceName)
+ 
+ void PublicService::setDomain(const QString &domain)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_domain = domain;
+     if (d->m_running) {
+         d->m_group->Reset();
+@@ -82,7 +82,7 @@ void PublicService::setDomain(const QString &domain)
+ 
+ void PublicService::setType(const QString &type)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_type = type;
+     if (d->m_running) {
+         d->m_group->Reset();
+@@ -92,7 +92,7 @@ void PublicService::setType(const QString &type)
+ 
+ void PublicService::setSubTypes(const QStringList &subtypes)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_subtypes = subtypes;
+     if (d->m_running) {
+         d->m_group->Reset();
+@@ -102,13 +102,13 @@ void PublicService::setSubTypes(const QStringList &subtypes)
+ 
+ QStringList PublicService::subtypes() const
+ {
+-    Q_D(const PublicService);
++    KDNSSD_D;
+     return d->m_subtypes;
+ }
+ 
+ void PublicService::setPort(unsigned short port)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_port = port;
+     if (d->m_running) {
+         d->m_group->Reset();
+@@ -118,7 +118,7 @@ void PublicService::setPort(unsigned short port)
+ 
+ void PublicService::setTextData(const QMap<QString, QByteArray> &textData)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_textData = textData;
+     if (d->m_running) {
+         d->m_group->Reset();
+@@ -128,13 +128,13 @@ void PublicService::setTextData(const QMap<QString, QByteArray> &textData)
+ 
+ bool PublicService::isPublished() const
+ {
+-    Q_D(const PublicService);
++    KDNSSD_D;
+     return d->m_published;
+ }
+ 
+ bool PublicService::publish()
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     publishAsync();
+     while (d->m_running && !d->m_published) {
+         QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
+@@ -144,7 +144,7 @@ bool PublicService::publish()
+ 
+ void PublicService::stop()
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     if (d->m_group) {
+         d->m_group->Reset();
+     }
+@@ -259,7 +259,7 @@ void PublicServicePrivate::serverStateChanged(int s, const QString &)
+ 
+ void PublicService::publishAsync()
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     if (d->m_running) {
+         stop();
+     }
+diff --git a/src/avahi-publicservice_p.h b/src/avahi-publicservice_p.h
+index 5311deb..5c8c0bc 100644
+--- a/src/avahi-publicservice_p.h
++++ b/src/avahi-publicservice_p.h
+@@ -17,6 +17,8 @@
+ #include "avahi_server_interface.h"
+ #include "avahi_entrygroup_interface.h"
+ 
++#define KDNSSD_D PublicServicePrivate* d = static_cast<PublicServicePrivate*>(this->d.operator->())
++
+ namespace KDNSSD
+ {
+ 
+diff --git a/src/avahi-remoteservice.cpp b/src/avahi-remoteservice.cpp
+index 0b66457..2489976 100644
+--- a/src/avahi-remoteservice.cpp
++++ b/src/avahi-remoteservice.cpp
+@@ -29,7 +29,7 @@ RemoteService::~RemoteService()
+ 
+ bool RemoteService::resolve()
+ {
+-    Q_D(RemoteService);
++    KDNSSD_D;
+     resolveAsync();
+     while (d->m_running && !d->m_resolved) {
+         QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
+@@ -39,7 +39,7 @@ bool RemoteService::resolve()
+ 
+ void RemoteService::resolveAsync()
+ {
+-    Q_D(RemoteService);
++    KDNSSD_D;
+     if (d->m_running) {
+         return;
+     }
+@@ -99,7 +99,7 @@ void RemoteService::resolveAsync()
+ 
+ bool RemoteService::isResolved() const
+ {
+-    Q_D(const RemoteService);
++    KDNSSD_D;
+     return d->m_resolved;
+ }
+ 
+diff --git a/src/avahi-remoteservice_p.h b/src/avahi-remoteservice_p.h
+index 738e237..659f75b 100644
+--- a/src/avahi-remoteservice_p.h
++++ b/src/avahi-remoteservice_p.h
+@@ -17,6 +17,8 @@
+ #include "avahi_listener_p.h"
+ #include "avahi_serviceresolver_interface.h"
+ 
++#define KDNSSD_D RemoteServicePrivate* d = static_cast<RemoteServicePrivate*>(this->d.operator->())
++
+ namespace KDNSSD
+ {
+ 
+diff --git a/src/mdnsd-publicservice.cpp b/src/mdnsd-publicservice.cpp
+index 9a1ecfb..351f50f 100644
+--- a/src/mdnsd-publicservice.cpp
++++ b/src/mdnsd-publicservice.cpp
+@@ -14,6 +14,8 @@
+ #include "mdnsd-sdevent.h"
+ #include "mdnsd-responder.h"
+ 
++#define KDNSSD_D PublicServicePrivate* d = static_cast<PublicServicePrivate*>(this->d.operator->())
++
+ namespace KDNSSD
+ {
+ void publish_callback(DNSServiceRef, DNSServiceFlags, DNSServiceErrorType errorCode, const char *name,
+@@ -35,7 +37,7 @@ PublicService::PublicService(const QString &name, const QString &type, unsigned
+                              const QString &domain, const QStringList &subtypes)
+     : QObject(), ServiceBase(new PublicServicePrivate(this, name, type, port, domain))
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     if (domain.isNull()) {
+         d->m_domain = "local.";
+     }
+@@ -49,7 +51,7 @@ PublicService::~PublicService()
+ 
+ void PublicService::setServiceName(const QString &serviceName)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_serviceName = serviceName;
+     if (d->isRunning()) {
+         stop();
+@@ -59,7 +61,7 @@ void PublicService::setServiceName(const QString &serviceName)
+ 
+ void PublicService::setDomain(const QString &domain)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_domain = domain;
+     if (d->isRunning()) {
+         stop();
+@@ -69,13 +71,13 @@ void PublicService::setDomain(const QString &domain)
+ 
+ QStringList PublicService::subtypes() const
+ {
+-    Q_D(const PublicService);
++    KDNSSD_D;
+     return d->m_subtypes;
+ }
+ 
+ void PublicService::setType(const QString &type)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_type = type;
+     if (d->isRunning()) {
+         stop();
+@@ -85,7 +87,7 @@ void PublicService::setType(const QString &type)
+ 
+ void PublicService::setSubTypes(const QStringList &subtypes)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_subtypes = subtypes;
+     if (d->isRunning()) {
+         stop();
+@@ -95,7 +97,7 @@ void PublicService::setSubTypes(const QStringList &subtypes)
+ 
+ void PublicService::setPort(unsigned short port)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_port = port;
+     if (d->isRunning()) {
+         stop();
+@@ -105,13 +107,13 @@ void PublicService::setPort(unsigned short port)
+ 
+ bool PublicService::isPublished() const
+ {
+-    Q_D(const PublicService);
++    KDNSSD_D;
+     return d->m_published;
+ }
+ 
+ void PublicService::setTextData(const QMap<QString, QByteArray> &textData)
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->m_textData = textData;
+     if (d->isRunning()) {
+         stop();
+@@ -121,7 +123,7 @@ void PublicService::setTextData(const QMap<QString, QByteArray> &textData)
+ 
+ bool PublicService::publish()
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     publishAsync();
+     while (d->isRunning() && !d->m_published) {
+         d->process();
+@@ -131,14 +133,14 @@ bool PublicService::publish()
+ 
+ void PublicService::stop()
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     d->stop();
+     d->m_published = false;
+ }
+ 
+ void PublicService::publishAsync()
+ {
+-    Q_D(PublicService);
++    KDNSSD_D;
+     if (d->isRunning()) {
+         stop();
+     }
+diff --git a/src/mdnsd-remoteservice.cpp b/src/mdnsd-remoteservice.cpp
+index 33167c4..ce2b08e 100644
+--- a/src/mdnsd-remoteservice.cpp
++++ b/src/mdnsd-remoteservice.cpp
+@@ -29,6 +29,8 @@ void resolve_callback(DNSServiceRef,
+                       void                                *context
+                      );
+ 
++#define KDNSSD_D RemoteServicePrivate* d = static_cast<RemoteServicePrivate*>(this->d.operator->())
++
+ class RemoteServicePrivate : public Responder, public ServiceBasePrivate
+ {
+ public:
+@@ -50,7 +52,7 @@ RemoteService::~RemoteService()
+ 
+ bool RemoteService::resolve()
+ {
+-    Q_D(RemoteService);
++    KDNSSD_D;
+     resolveAsync();
+     while (d->isRunning() && !d->m_resolved) {
+         d->process();
+@@ -61,7 +63,7 @@ bool RemoteService::resolve()
+ 
+ void RemoteService::resolveAsync()
+ {
+-    Q_D(RemoteService);
++    KDNSSD_D;
+     if (d->isRunning()) {
+         return;
+     }
+@@ -80,7 +82,7 @@ void RemoteService::resolveAsync()
+ 
+ bool RemoteService::isResolved() const
+ {
+-    Q_D(const RemoteService);
++    KDNSSD_D;
+     return d->m_resolved;
+ }
+ 
+diff --git a/src/publicservice.h b/src/publicservice.h
+index 91c8fde..de2931e 100644
+--- a/src/publicservice.h
++++ b/src/publicservice.h
+@@ -216,7 +216,6 @@ protected:
+ 
+ private:
+     friend class PublicServicePrivate;
+-    Q_DECLARE_PRIVATE_D(ServiceBase::d, PublicService)
+ };
+ 
+ }
+diff --git a/src/remoteservice.h b/src/remoteservice.h
+index 465d6e0..e99e4f6 100644
+--- a/src/remoteservice.h
++++ b/src/remoteservice.h
+@@ -119,7 +119,6 @@ protected:
+ 
+ private:
+     friend class RemoteServicePrivate;
+-    Q_DECLARE_PRIVATE_D(ServiceBase::d, RemoteService)
+ };
+ 
+ }
+diff --git a/src/servicebase.cpp b/src/servicebase.cpp
+index 05e7085..bf5e77e 100644
+--- a/src/servicebase.cpp
++++ b/src/servicebase.cpp
+@@ -27,49 +27,35 @@ ServiceBase::~ServiceBase() = default;
+ 
+ QString ServiceBase::serviceName() const
+ {
+-    Q_D(const ServiceBase);
+-
+     return d->m_serviceName;
+ }
+ 
+ QString ServiceBase::type() const
+ {
+-    Q_D(const ServiceBase);
+-
+     return d->m_type;
+ }
+ 
+ QString ServiceBase::domain() const
+ {
+-    Q_D(const ServiceBase);
+-
+     return d->m_domain;
+ }
+ 
+ QString ServiceBase::hostName() const
+ {
+-    Q_D(const ServiceBase);
+-
+     return d->m_hostName;
+ }
+ 
+ unsigned short ServiceBase::port() const
+ {
+-    Q_D(const ServiceBase);
+-
+     return d->m_port;
+ }
+ QMap<QString, QByteArray> ServiceBase::textData() const
+ {
+-    Q_D(const ServiceBase);
+-
+     return d->m_textData;
+ }
+ 
+ bool ServiceBase::operator==(const ServiceBase &o) const
+ {
+-    Q_D(const ServiceBase);
+-
+     return d->m_domain == o.d->m_domain && d->m_serviceName == o.d->m_serviceName && d->m_type == o.d->m_type;
+ }
+ 
+diff --git a/src/servicebase.h b/src/servicebase.h
+index d0e0e5e..0decf31 100644
+--- a/src/servicebase.h
++++ b/src/servicebase.h
+@@ -178,7 +178,12 @@ protected:
+ 
+ protected:
+     std::unique_ptr<ServiceBasePrivate> const d;
+-    Q_DECLARE_PRIVATE_D(d, ServiceBase)
++    // We cannot use Q_DECLARE_PRIVATE_D & Q_D here because of multiple inheritance with some
++    // of the subclasses of ServiceBasePrivate, where ServiceBasePrivate is not the first base class,
++    // so reinterpret_cast as used by the functions defined with Q_DECLARE_PRIVATE_D would fail.
++    // Using a custom macro here with static_cast would require to know about the type definition
++    // of the private classes, which we though want to avoid here in the public class.
++    // So instead some custom KDNSSD_D macros are used internally...
+ };
+ 
+ /* Utility functions */
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..875f557
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+8c14803908a2a718fa0716fb98506aebda1fed46.diff


More information about the Neon-commits mailing list