summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2020-06-05 02:24:41 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2020-06-05 02:38:25 +0200
commiteb77bf011bd6d6a7c81fb6ed27d0bc23b7782c71 (patch)
tree7f6effefc589945ace2dc7fb10acb8d4ce3a6dea /net-libs/signond
parentdev-cpp/asio: update maintainer and upstream (diff)
downloadgentoo-eb77bf011bd6d6a7c81fb6ed27d0bc23b7782c71.tar.gz
gentoo-eb77bf011bd6d6a7c81fb6ed27d0bc23b7782c71.tar.bz2
gentoo-eb77bf011bd6d6a7c81fb6ed27d0bc23b7782c71.zip
net-libs/signond: Fix runtime crashes
Package-Manager: Portage-2.3.100, Repoman-2.3.22 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'net-libs/signond')
-rw-r--r--net-libs/signond/files/signond-8.60-crashfix.patch160
-rw-r--r--net-libs/signond/signond-8.60-r2.ebuild76
2 files changed, 236 insertions, 0 deletions
diff --git a/net-libs/signond/files/signond-8.60-crashfix.patch b/net-libs/signond/files/signond-8.60-crashfix.patch
new file mode 100644
index 000000000000..8cfc79ac431e
--- /dev/null
+++ b/net-libs/signond/files/signond-8.60-crashfix.patch
@@ -0,0 +1,160 @@
+From ab9fab9763277783363f8c6d4b62405c3b0b0413 Mon Sep 17 00:00:00 2001
+From: Chris Adams <chris.adams@jollamobile.com>
+Date: Wed, 31 Jul 2019 12:45:14 +1000
+Subject: [PATCH] Don't emit QObject::destroyed() within Identity::destroy()
+
+QObject::destroyed() should not be emitted manually, as that can
+cause unwanted side effects.
+
+Specifically, in this case, the
+QDBusConnectionPrivate::objectDestroyed() slot was invoked with
+invalidated object parameter (perhaps due to duplicate invocation)
+resulting in a warning in QObject::disconnect().
+
+Instead, ensure the object is unregistered from DBus immediately.
+---
+ src/signond/signondaemonadaptor.cpp | 29 ++++++++++++++++++++++++++++-
+ src/signond/signondaemonadaptor.h | 3 +++
+ src/signond/signonidentity.cpp | 13 ++++++++-----
+ src/signond/signonidentity.h | 1 +
+ 4 files changed, 40 insertions(+), 6 deletions(-)
+
+diff --git a/src/signond/signondaemonadaptor.cpp b/src/signond/signondaemonadaptor.cpp
+index 8b35e4bd..abd8fd3a 100644
+--- a/src/signond/signondaemonadaptor.cpp
++++ b/src/signond/signondaemonadaptor.cpp
+@@ -29,6 +29,13 @@
+
+ namespace SignonDaemonNS {
+
++struct RegisteredIdentity {
++ RegisteredIdentity(const QDBusConnection &connection, QObject *identity)
++ : conn(connection), ident(identity) {}
++ QDBusConnection conn;
++ QObject *ident = nullptr;
++};
++
+ SignonDaemonAdaptor::SignonDaemonAdaptor(SignonDaemon *parent):
+ QDBusAbstractAdaptor(parent),
+ m_parent(parent)
+@@ -38,6 +45,7 @@ SignonDaemonAdaptor::SignonDaemonAdaptor(SignonDaemon *parent):
+
+ SignonDaemonAdaptor::~SignonDaemonAdaptor()
+ {
++ qDeleteAll(m_registeredIdentities);
+ }
+
+ void SignonDaemonAdaptor::registerNewIdentity(const QString &applicationContext,
+@@ -46,7 +54,10 @@ void SignonDaemonAdaptor::registerNewIdentity(const QString &applicationContext,
+ Q_UNUSED(applicationContext);
+
+ QObject *identity = m_parent->registerNewIdentity();
+- objectPath = registerObject(parentDBusContext().connection(), identity);
++ QDBusConnection dbusConnection(parentDBusContext().connection());
++ objectPath = registerObject(dbusConnection, identity);
++ m_registeredIdentities.append(new RegisteredIdentity(dbusConnection, identity));
++ connect(identity, SIGNAL(unregistered()), this, SLOT(onIdentityUnregistered()));
+
+ SignonDisposable::destroyUnused();
+ }
+@@ -130,6 +141,22 @@ void SignonDaemonAdaptor::getIdentity(const quint32 id,
+ SignonDisposable::destroyUnused();
+ }
+
++void SignonDaemonAdaptor::onIdentityUnregistered()
++{
++ QObject *ident = sender();
++ if (!ident) {
++ return;
++ }
++
++ for (int i = 0; i < m_registeredIdentities.size(); ++i) {
++ if (m_registeredIdentities[i]->ident == ident) {
++ m_registeredIdentities[i]->conn.unregisterObject(ident->objectName());
++ delete m_registeredIdentities.takeAt(i);
++ return;
++ }
++ }
++}
++
+ void SignonDaemonAdaptor::onIdentityAccessReplyFinished()
+ {
+ SignOn::AccessReply *reply = qobject_cast<SignOn::AccessReply*>(sender());
+diff --git a/src/signond/signondaemonadaptor.h b/src/signond/signondaemonadaptor.h
+index db8d875f..1c20cac3 100644
+--- a/src/signond/signondaemonadaptor.h
++++ b/src/signond/signondaemonadaptor.h
+@@ -34,6 +34,7 @@
+ namespace SignonDaemonNS {
+
+ typedef QList<QVariantMap> MapList;
++class RegisteredIdentity;
+
+ class SignonDaemonAdaptor: public QDBusAbstractAdaptor
+ {
+@@ -74,10 +75,12 @@ private:
+ QObject *object);
+
+ private Q_SLOTS:
++ void onIdentityUnregistered();
+ void onIdentityAccessReplyFinished();
+ void onAuthSessionAccessReplyFinished();
+
+ private:
++ QList<RegisteredIdentity*> m_registeredIdentities;
+ SignonDaemon *m_parent;
+ }; //class SignonDaemonAdaptor
+
+diff --git a/src/signond/signonidentity.cpp b/src/signond/signonidentity.cpp
+index ce1ecfb0..a143c223 100644
+--- a/src/signond/signonidentity.cpp
++++ b/src/signond/signonidentity.cpp
+@@ -84,7 +84,8 @@ private:
+ SignonIdentity::SignonIdentity(quint32 id, int timeout,
+ SignonDaemon *parent):
+ SignonDisposable(timeout, parent),
+- m_pInfo(NULL)
++ m_pInfo(NULL),
++ m_destroyed(false)
+ {
+ m_id = id;
+
+@@ -112,7 +113,10 @@ SignonIdentity::SignonIdentity(quint32 id, int timeout,
+
+ SignonIdentity::~SignonIdentity()
+ {
+- emit unregistered();
++ if (!m_destroyed) {
++ m_destroyed = true;
++ Q_EMIT unregistered();
++ }
+
+ delete m_signonui;
+ delete m_pInfo;
+@@ -125,9 +129,8 @@ SignonIdentity *SignonIdentity::createIdentity(quint32 id, SignonDaemon *parent)
+
+ void SignonIdentity::destroy()
+ {
+- /* Emitting the destroyed signal makes QDBusConnection unregister the
+- * object */
+- Q_EMIT destroyed();
++ m_destroyed = true;
++ Q_EMIT unregistered();
+ deleteLater();
+ }
+
+diff --git a/src/signond/signonidentity.h b/src/signond/signonidentity.h
+index 9ec9be4e..f6321f30 100644
+--- a/src/signond/signonidentity.h
++++ b/src/signond/signonidentity.h
+@@ -96,6 +96,7 @@ private:
+ quint32 m_id;
+ SignonUiAdaptor *m_signonui;
+ SignonIdentityInfo *m_pInfo;
++ bool m_destroyed;
+ }; //class SignonDaemon
+
+ } //namespace SignonDaemonNS
+--
+2.26.2
+
diff --git a/net-libs/signond/signond-8.60-r2.ebuild b/net-libs/signond/signond-8.60-r2.ebuild
new file mode 100644
index 000000000000..b1040feb3ec3
--- /dev/null
+++ b/net-libs/signond/signond-8.60-r2.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit qmake-utils
+
+DESCRIPTION="Signon daemon for libaccounts-glib"
+HOMEPAGE="https://gitlab.com/accounts-sso"
+SRC_URI="https://gitlab.com/accounts-sso/${PN}/-/archive/VERSION_${PV}/${PN}-VERSION_${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
+IUSE="doc test"
+
+BDEPEND="doc? ( app-doc/doxygen )"
+RDEPEND="
+ dev-qt/qtcore:5
+ dev-qt/qtdbus:5
+ dev-qt/qtgui:5
+ dev-qt/qtnetwork:5
+ dev-qt/qtsql:5
+ net-libs/libproxy
+"
+DEPEND="${RDEPEND}
+ test? ( dev-qt/qttest:5 )
+"
+
+RESTRICT="!test? ( test )"
+
+PATCHES=(
+ "${FILESDIR}/${P}-buildsystem.patch"
+ "${FILESDIR}/${P}-consistent-paths.patch" # bug 701142
+ "${FILESDIR}/${P}-crashfix.patch"
+)
+
+S="${WORKDIR}/${PN}-VERSION_${PV}"
+
+src_prepare() {
+ default
+
+ # install docs to correct location
+ sed -e "s|share/doc/\$\${PROJECT_NAME}|share/doc/${PF}|" \
+ -i doc/doc.pri || die
+ sed -e "/^documentation.path = /c\documentation.path = \$\${INSTALL_PREFIX}/share/doc/${PF}/\$\${TARGET}/" \
+ -i lib/plugins/doc/doc.pri || die
+ sed -e "/^documentation.path = /c\documentation.path = \$\${INSTALL_PREFIX}/share/doc/${PF}/libsignon-qt/" \
+ -i lib/SignOn/doc/doc.pri || die
+
+ # std flags
+ sed -e "/CONFIG += c++11/d" \
+ -i common-project-config.pri || die "failed fixing CXXFLAGS"
+
+ # fix runtime failures
+ sed -e "/fno-rtti/d" \
+ -i common-project-config.pri src/plugins/plugins.pri \
+ src/{remotepluginprocess/remotepluginprocess,extensions/cryptsetup/cryptsetup}.pro \
+ tests/{signond-tests/signond-tests,extensions/extensions}.pri \
+ tests/{passwordplugintest/passwordplugintest,libsignon-qt-tests/libsignon-qt-tests}.pro \
+ || die "failed disabling -fno-rtti"
+
+ use doc || sed -e "/include(\s*doc\/doc.pri\s*)/d" \
+ -i signon.pro lib/SignOn/SignOn.pro lib/plugins/plugins.pro || die
+
+ use test || sed -e '/^SUBDIRS/s/tests//' \
+ -i signon.pro || die "couldn't disable tests"
+}
+
+src_configure() {
+ eqmake5 PREFIX="${EPREFIX}"/usr LIBDIR=$(get_libdir)
+}
+
+src_install() {
+ emake INSTALL_ROOT="${D}" install
+}