Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-qt/qtnetwork/files/, dev-qt/qtnetwork/
Date: Sat, 02 Jan 2021 01:23:08
Message-Id: 1609550553.68426bc06c976362ef7cc51e57a676535e7e310e.asturm@gentoo
1 commit: 68426bc06c976362ef7cc51e57a676535e7e310e
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 1 16:56:08 2021 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 2 01:22:33 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=68426bc0
7
8 dev-qt/qtnetwork: Fix memleak in QNetworkAccessManager
9
10 See also: https://bugreports.qt.io/browse/QTBUG-88063
11
12 Package-Manager: Portage-3.0.12, Repoman-3.0.2
13 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
14
15 ...work-5.15.2-QNetworkAccessManager-memleak.patch | 41 +++++++++++
16 dev-qt/qtnetwork/qtnetwork-5.15.2-r1.ebuild | 80 ++++++++++++++++++++++
17 2 files changed, 121 insertions(+)
18
19 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
20 new file mode 100644
21 index 00000000000..be2c1f6e1a0
22 --- /dev/null
23 +++ b/dev-qt/qtnetwork/files/qtnetwork-5.15.2-QNetworkAccessManager-memleak.patch
24 @@ -0,0 +1,41 @@
25 +From 0807f16eb407eaf8a5b34b67602d0a97778d945d Mon Sep 17 00:00:00 2001
26 +From: =?utf8?q?M=C3=A5rten=20Nordheim?= <marten.nordheim@××.io>
27 +Date: Fri, 6 Nov 2020 12:51:42 +0100
28 +Subject: [PATCH] QNAM: Work around QObject finicky orphan cleanup details
29 +
30 +Details described in a comment.
31 +
32 +Task-number: QTBUG-88063
33 +Change-Id: I763ecfedf518de97615e04a8eaae0fe1fd784f52
34 +Reviewed-by: Timur Pocheptsov <timur.pocheptsov@××.io>
35 +(cherry picked from commit 1c6d6cbb62c5e93cbcad2d740c3b0ed01095618c)
36 +Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@××××××××××.org>
37 +---
38 + src/network/access/qnetworkreplyhttpimpl.cpp | 12 +++++++++++-
39 + 1 file changed, 11 insertions(+), 1 deletion(-)
40 +
41 +diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
42 +index 21916f53f15..727c1a0316d 100644
43 +--- a/src/network/access/qnetworkreplyhttpimpl.cpp
44 ++++ b/src/network/access/qnetworkreplyhttpimpl.cpp
45 +@@ -808,7 +808,17 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
46 +
47 + // For the synchronous HTTP, this is the normal way the delegate gets deleted
48 + // For the asynchronous HTTP this is a safety measure, the delegate deletes itself when HTTP is finished
49 +- QObject::connect(thread, SIGNAL(finished()), delegate, SLOT(deleteLater()));
50 ++ QMetaObject::Connection threadFinishedConnection =
51 ++ QObject::connect(thread, SIGNAL(finished()), delegate, SLOT(deleteLater()));
52 ++
53 ++ // QTBUG-88063: When 'delegate' is deleted the connection will be added to 'thread''s orphaned
54 ++ // connections list. This orphaned list will be cleaned up next time 'thread' emits a signal,
55 ++ // unfortunately that's the finished signal. It leads to a soft-leak so we do this to disconnect
56 ++ // it on deletion so that it cleans up the orphan immediately.
57 ++ QObject::connect(delegate, &QObject::destroyed, delegate, [threadFinishedConnection]() {
58 ++ if (bool(threadFinishedConnection))
59 ++ QObject::disconnect(threadFinishedConnection);
60 ++ });
61 +
62 + // Set the properties it needs
63 + delegate->httpRequest = httpRequest;
64 +--
65 +2.16.3
66
67 diff --git a/dev-qt/qtnetwork/qtnetwork-5.15.2-r1.ebuild b/dev-qt/qtnetwork/qtnetwork-5.15.2-r1.ebuild
68 new file mode 100644
69 index 00000000000..9d366649d1c
70 --- /dev/null
71 +++ b/dev-qt/qtnetwork/qtnetwork-5.15.2-r1.ebuild
72 @@ -0,0 +1,80 @@
73 +# Copyright 1999-2021 Gentoo Authors
74 +# Distributed under the terms of the GNU General Public License v2
75 +
76 +EAPI=7
77 +
78 +QT5_MODULE="qtbase"
79 +inherit qt5-build
80 +
81 +DESCRIPTION="Network abstraction library for the Qt5 framework"
82 +
83 +if [[ ${QT5_BUILD_TYPE} == release ]]; then
84 + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
85 +fi
86 +
87 +IUSE="bindist connman gssapi libressl libproxy networkmanager sctp +ssl"
88 +
89 +DEPEND="
90 + ~dev-qt/qtcore-${PV}:5=
91 + sys-libs/zlib:=
92 + connman? ( ~dev-qt/qtdbus-${PV} )
93 + gssapi? ( virtual/krb5 )
94 + libproxy? ( net-libs/libproxy )
95 + networkmanager? ( ~dev-qt/qtdbus-${PV} )
96 + sctp? ( kernel_linux? ( net-misc/lksctp-tools ) )
97 + ssl? (
98 + !libressl? ( >=dev-libs/openssl-1.1.1:0=[bindist=] )
99 + libressl? ( dev-libs/libressl:0= )
100 + )
101 +"
102 +RDEPEND="${DEPEND}
103 + connman? ( net-misc/connman )
104 + networkmanager? ( net-misc/networkmanager )
105 +"
106 +
107 +QT5_TARGET_SUBDIRS=(
108 + src/network
109 + src/plugins/bearer/generic
110 +)
111 +
112 +QT5_GENTOO_CONFIG=(
113 + libproxy:libproxy:
114 + ssl::SSL
115 + ssl::OPENSSL
116 + ssl:openssl-linked:LINKED_OPENSSL
117 +)
118 +
119 +QT5_GENTOO_PRIVATE_CONFIG=(
120 + :network
121 +)
122 +
123 +PATCHES=(
124 + "${FILESDIR}"/${P}-QNetworkAccessManager-memleak.patch # QTBUG-88063
125 + "${FILESDIR}"/${PN}-5.15.2-libressl.patch # Bug 562050, not upstreamable
126 +)
127 +
128 +pkg_setup() {
129 + use connman && QT5_TARGET_SUBDIRS+=(src/plugins/bearer/connman)
130 + use networkmanager && QT5_TARGET_SUBDIRS+=(src/plugins/bearer/networkmanager)
131 +}
132 +
133 +src_configure() {
134 + local myconf=(
135 + $(usex connman -dbus-linked '')
136 + $(usex gssapi -feature-gssapi -no-feature-gssapi)
137 + $(qt_use libproxy)
138 + $(usex networkmanager -dbus-linked '')
139 + $(qt_use sctp)
140 + $(usex ssl -openssl-linked '')
141 + )
142 + qt5-build_src_configure
143 +}
144 +
145 +src_install() {
146 + qt5-build_src_install
147 + # workaround for bug 652650
148 + if use ssl; then
149 + sed -e "/^#define QT_LINKED_OPENSSL/s/$/ true/" \
150 + -i "${D}${QT5_HEADERDIR}"/Gentoo/${PN}-qconfig.h || die
151 + fi
152 +}