summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2021-01-01 17:56:08 +0100
committerAndreas Sturmlechner <asturm@gentoo.org>2021-01-02 02:22:33 +0100
commit68426bc06c976362ef7cc51e57a676535e7e310e (patch)
tree18bfb6933efec91ad06a5e076f3d3ca0961fb77a /dev-qt/qtnetwork
parentdev-qt/qtlocation: Drop 5.15.2 (r0) (diff)
downloadgentoo-68426bc06c976362ef7cc51e57a676535e7e310e.tar.gz
gentoo-68426bc06c976362ef7cc51e57a676535e7e310e.tar.bz2
gentoo-68426bc06c976362ef7cc51e57a676535e7e310e.zip
dev-qt/qtnetwork: Fix memleak in QNetworkAccessManager
See also: https://bugreports.qt.io/browse/QTBUG-88063 Package-Manager: Portage-3.0.12, Repoman-3.0.2 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'dev-qt/qtnetwork')
-rw-r--r--dev-qt/qtnetwork/files/qtnetwork-5.15.2-QNetworkAccessManager-memleak.patch41
-rw-r--r--dev-qt/qtnetwork/qtnetwork-5.15.2-r1.ebuild80
2 files changed, 121 insertions, 0 deletions
diff --git a/dev-qt/qtnetwork/files/qtnetwork-5.15.2-QNetworkAccessManager-memleak.patch b/dev-qt/qtnetwork/files/qtnetwork-5.15.2-QNetworkAccessManager-memleak.patch
new file mode 100644
index 00000000000..be2c1f6e1a0
--- /dev/null
+++ b/dev-qt/qtnetwork/files/qtnetwork-5.15.2-QNetworkAccessManager-memleak.patch
@@ -0,0 +1,41 @@
+From 0807f16eb407eaf8a5b34b67602d0a97778d945d Mon Sep 17 00:00:00 2001
+From: =?utf8?q?M=C3=A5rten=20Nordheim?= <marten.nordheim@qt.io>
+Date: Fri, 6 Nov 2020 12:51:42 +0100
+Subject: [PATCH] QNAM: Work around QObject finicky orphan cleanup details
+
+Details described in a comment.
+
+Task-number: QTBUG-88063
+Change-Id: I763ecfedf518de97615e04a8eaae0fe1fd784f52
+Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
+(cherry picked from commit 1c6d6cbb62c5e93cbcad2d740c3b0ed01095618c)
+Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
+---
+ src/network/access/qnetworkreplyhttpimpl.cpp | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
+index 21916f53f15..727c1a0316d 100644
+--- a/src/network/access/qnetworkreplyhttpimpl.cpp
++++ b/src/network/access/qnetworkreplyhttpimpl.cpp
+@@ -808,7 +808,17 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
+
+ // For the synchronous HTTP, this is the normal way the delegate gets deleted
+ // For the asynchronous HTTP this is a safety measure, the delegate deletes itself when HTTP is finished
+- QObject::connect(thread, SIGNAL(finished()), delegate, SLOT(deleteLater()));
++ QMetaObject::Connection threadFinishedConnection =
++ QObject::connect(thread, SIGNAL(finished()), delegate, SLOT(deleteLater()));
++
++ // QTBUG-88063: When 'delegate' is deleted the connection will be added to 'thread''s orphaned
++ // connections list. This orphaned list will be cleaned up next time 'thread' emits a signal,
++ // unfortunately that's the finished signal. It leads to a soft-leak so we do this to disconnect
++ // it on deletion so that it cleans up the orphan immediately.
++ QObject::connect(delegate, &QObject::destroyed, delegate, [threadFinishedConnection]() {
++ if (bool(threadFinishedConnection))
++ QObject::disconnect(threadFinishedConnection);
++ });
+
+ // Set the properties it needs
+ delegate->httpRequest = httpRequest;
+--
+2.16.3
diff --git a/dev-qt/qtnetwork/qtnetwork-5.15.2-r1.ebuild b/dev-qt/qtnetwork/qtnetwork-5.15.2-r1.ebuild
new file mode 100644
index 00000000000..9d366649d1c
--- /dev/null
+++ b/dev-qt/qtnetwork/qtnetwork-5.15.2-r1.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+QT5_MODULE="qtbase"
+inherit qt5-build
+
+DESCRIPTION="Network abstraction library for the Qt5 framework"
+
+if [[ ${QT5_BUILD_TYPE} == release ]]; then
+ KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
+fi
+
+IUSE="bindist connman gssapi libressl libproxy networkmanager sctp +ssl"
+
+DEPEND="
+ ~dev-qt/qtcore-${PV}:5=
+ sys-libs/zlib:=
+ connman? ( ~dev-qt/qtdbus-${PV} )
+ gssapi? ( virtual/krb5 )
+ libproxy? ( net-libs/libproxy )
+ networkmanager? ( ~dev-qt/qtdbus-${PV} )
+ sctp? ( kernel_linux? ( net-misc/lksctp-tools ) )
+ ssl? (
+ !libressl? ( >=dev-libs/openssl-1.1.1:0=[bindist=] )
+ libressl? ( dev-libs/libressl:0= )
+ )
+"
+RDEPEND="${DEPEND}
+ connman? ( net-misc/connman )
+ networkmanager? ( net-misc/networkmanager )
+"
+
+QT5_TARGET_SUBDIRS=(
+ src/network
+ src/plugins/bearer/generic
+)
+
+QT5_GENTOO_CONFIG=(
+ libproxy:libproxy:
+ ssl::SSL
+ ssl::OPENSSL
+ ssl:openssl-linked:LINKED_OPENSSL
+)
+
+QT5_GENTOO_PRIVATE_CONFIG=(
+ :network
+)
+
+PATCHES=(
+ "${FILESDIR}"/${P}-QNetworkAccessManager-memleak.patch # QTBUG-88063
+ "${FILESDIR}"/${PN}-5.15.2-libressl.patch # Bug 562050, not upstreamable
+)
+
+pkg_setup() {
+ use connman && QT5_TARGET_SUBDIRS+=(src/plugins/bearer/connman)
+ use networkmanager && QT5_TARGET_SUBDIRS+=(src/plugins/bearer/networkmanager)
+}
+
+src_configure() {
+ local myconf=(
+ $(usex connman -dbus-linked '')
+ $(usex gssapi -feature-gssapi -no-feature-gssapi)
+ $(qt_use libproxy)
+ $(usex networkmanager -dbus-linked '')
+ $(qt_use sctp)
+ $(usex ssl -openssl-linked '')
+ )
+ qt5-build_src_configure
+}
+
+src_install() {
+ qt5-build_src_install
+ # workaround for bug 652650
+ if use ssl; then
+ sed -e "/^#define QT_LINKED_OPENSSL/s/$/ true/" \
+ -i "${D}${QT5_HEADERDIR}"/Gentoo/${PN}-qconfig.h || die
+ fi
+}