diff --git a/0001-pipewire-stream-Don-t-leak-GSource-s.patch b/0001-pipewire-stream-Don-t-leak-GSource-s.patch new file mode 100644 index 0000000..ee4840a --- /dev/null +++ b/0001-pipewire-stream-Don-t-leak-GSource-s.patch @@ -0,0 +1,53 @@ +From 2fba1c597f272516759933ee439e6fef3f6142f3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Tue, 6 Apr 2021 11:32:14 +0200 +Subject: [PATCH] pipewire-stream: Don't leak GSource's + +The pipewire loop is owned by the source, and failing to free it means +pipewire will keep file descriptors open indefinitely. + +While we properly "destroy":ed the source, destroying it only removes it +from the context, it doesn't destroy or unref it. To also free it, we +also need to unref it. +--- + src/grd-rdp-pipewire-stream.c | 6 +++++- + src/grd-vnc-pipewire-stream.c | 6 +++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/grd-rdp-pipewire-stream.c b/src/grd-rdp-pipewire-stream.c +index 09015e7..6c79312 100644 +--- a/src/grd-rdp-pipewire-stream.c ++++ b/src/grd-rdp-pipewire-stream.c +@@ -577,7 +577,11 @@ grd_rdp_pipewire_stream_finalize (GObject *object) + + g_clear_pointer (&stream->pipewire_core, pw_core_disconnect); + g_clear_pointer (&stream->pipewire_context, pw_context_destroy); +- g_clear_pointer (&stream->pipewire_source, g_source_destroy); ++ if (stream->pipewire_source) ++ { ++ g_source_destroy (stream->pipewire_source); ++ g_clear_pointer (&stream->pipewire_source, g_source_unref); ++ } + + G_OBJECT_CLASS (grd_rdp_pipewire_stream_parent_class)->finalize (object); + } +diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c +index 82ceb9b..5085062 100644 +--- a/src/grd-vnc-pipewire-stream.c ++++ b/src/grd-vnc-pipewire-stream.c +@@ -594,7 +594,11 @@ grd_vnc_pipewire_stream_finalize (GObject *object) + + g_clear_pointer (&stream->pipewire_core, pw_core_disconnect); + g_clear_pointer (&stream->pipewire_context, pw_context_destroy); +- g_clear_pointer (&stream->pipewire_source, g_source_destroy); ++ if (stream->pipewire_source) ++ { ++ g_source_destroy (stream->pipewire_source); ++ g_clear_pointer (&stream->pipewire_source, g_source_unref); ++ } + + G_OBJECT_CLASS (grd_vnc_pipewire_stream_parent_class)->finalize (object); + } +-- +2.31.1 + diff --git a/gnome-remote-desktop.spec b/gnome-remote-desktop.spec index faa5f38..bda48af 100644 --- a/gnome-remote-desktop.spec +++ b/gnome-remote-desktop.spec @@ -15,7 +15,7 @@ Name: gnome-remote-desktop Version: 40.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: GNOME Remote Desktop screen share service License: GPLv2+ @@ -28,6 +28,10 @@ Source1: https://github.com/LibVNC/libvncserver/archive/refs/tags/%{libvn ### gnome-remote-desktop patches # Adds encryption support (requires patched LibVNCServer) Patch0: gnutls-anontls.patch + +# Backport upstream leak fix (rhbz#1951129) +Patch1: 0001-pipewire-stream-Don-t-leak-GSource-s.patch + %if 0%{?bundle_libvncserver} Patch100: 0001-build-Set-rpath-on-executable.patch %endif @@ -122,6 +126,7 @@ done %setup -n %{name}-%{tarball_version} %patch0 -p1 +%patch1 -p1 %if 0%{?bundle_libvncserver} %patch100 -p1 %endif @@ -203,6 +208,10 @@ popd %changelog +* Tue Jun 15 2021 Jonas Ã…dahl - 40.0-5 +- Backport leak fix + Resolves: #1951129 + * Mon May 17 2021 Ondrej Holy - 40.0-4 - Rebuild for updated FreeRDP (#1951123).