commit:     8d9c191ec4f0899045f4b420c57e7c40c8dc0468
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 11 20:52:28 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Fri Nov 11 23:17:00 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8d9c191e

sys-auth/polkit-qt: Fix memory leak

Upstream commit e6a3603b1f07cd85dbd84377afeda0777d6535e8

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/polkit-qt-0.114.0-fix-memory-leak.patch  | 36 +++++++++++++++++
 sys-auth/polkit-qt/polkit-qt-0.114.0-r2.ebuild     | 46 ++++++++++++++++++++++
 2 files changed, 82 insertions(+)

diff --git a/sys-auth/polkit-qt/files/polkit-qt-0.114.0-fix-memory-leak.patch 
b/sys-auth/polkit-qt/files/polkit-qt-0.114.0-fix-memory-leak.patch
new file mode 100644
index 000000000000..02f830cbf531
--- /dev/null
+++ b/sys-auth/polkit-qt/files/polkit-qt-0.114.0-fix-memory-leak.patch
@@ -0,0 +1,36 @@
+From e6a3603b1f07cd85dbd84377afeda0777d6535e8 Mon Sep 17 00:00:00 2001
+From: Zhang Dingyuan <justfor...@gmail.com>
+Date: Tue, 14 Jun 2022 11:37:40 +0800
+Subject: [PATCH] fix: memory leak
+
+agent listener does not reclaim private memory after destructing.
+Use `QScopedPointer` to protect private pointers from being copied and to
+reclaim memory properly.
+---
+ agent/polkitqt1-agent-listener.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/agent/polkitqt1-agent-listener.h 
b/agent/polkitqt1-agent-listener.h
+index 07fe03a..a40ff41 100644
+--- a/agent/polkitqt1-agent-listener.h
++++ b/agent/polkitqt1-agent-listener.h
+@@ -9,6 +9,7 @@
+ #define POLKITQT1_AGENT_LISTENER_H
+ 
+ #include <QObject>
++#include <QScopedPointer>
+ 
+ #include "polkitqt1-agent-session.h"
+ 
+@@ -137,7 +138,7 @@ public Q_SLOTS:
+     virtual void cancelAuthentication() = 0;
+ 
+ private:
+-    ListenerPrivate * const d;
++    QScopedPointer<ListenerPrivate> d;
+ };
+ }
+ 
+-- 
+GitLab
+

diff --git a/sys-auth/polkit-qt/polkit-qt-0.114.0-r2.ebuild 
b/sys-auth/polkit-qt/polkit-qt-0.114.0-r2.ebuild
new file mode 100644
index 000000000000..0bb9a6530f9b
--- /dev/null
+++ b/sys-auth/polkit-qt/polkit-qt-0.114.0-r2.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+KDE_ORG_CATEGORY="libraries"
+KDE_ORG_NAME="polkit-qt-1"
+inherit cmake kde.org
+
+DESCRIPTION="Qt wrapper around polkit-1 client libraries"
+HOMEPAGE="https://api.kde.org/polkit-qt-1/html/";
+
+if [[ ${KDE_BUILD_TYPE} = release ]]; then
+       
SRC_URI="mirror://kde/stable/${KDE_ORG_NAME}/${KDE_ORG_NAME}-${PV}.tar.xz"
+       KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+fi
+
+LICENSE="LGPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND="
+       dev-libs/glib:2
+       dev-qt/qtcore:5
+       dev-qt/qtdbus:5
+       dev-qt/qtgui:5
+       dev-qt/qtwidgets:5
+       >=sys-auth/polkit-0.103
+"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+DOCS=( AUTHORS README README.porting TODO )
+
+PATCHES=(
+       "${FILESDIR}/${P}-cmake.patch"
+       "${FILESDIR}/${P}-glib-2.36.patch"
+       "${FILESDIR}/${P}-fix-memory-leak.patch"
+)
+
+src_configure() {
+       local mycmakeargs=(
+               -DBUILD_EXAMPLES=OFF
+       )
+       cmake_src_configure
+}

Reply via email to