From 198851a7d351dff2f7a2bd068e41a0fdf9e6daca Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Thu, 6 Mar 2025 13:59:04 +0000 Subject: [PATCH] Bug 1942551 - WebRTC backport: PipeWire camera: Fix cleanup order a=pascalc The hook is associated with the proxy object. We should remove the hook first before destroying the proxy object to avoid use-after-free. This is a simple backport of an WebRTC upstream change. Upstream commit: caa8ef3ab511d54dfa486eb7599ef0a74f7471ee Original Revision: https://phabricator.services.mozilla.com/D239886 Differential Revision: https://phabricator.services.mozilla.com/D240592 --- .../libwebrtc/modules/video_capture/linux/pipewire_session.cc | 2 +- .../libwebrtc/moz-patch-stack/caa8ef3ab5.no-op-cherry-pick-msg | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 third_party/libwebrtc/moz-patch-stack/caa8ef3ab5.no-op-cherry-pick-msg diff --git a/third_party/libwebrtc/modules/video_capture/linux/pipewire_session.cc b/third_party/libwebrtc/modules/video_capture/linux/pipewire_session.cc index d52d6aacc800..b5f63d757f17 100644 --- a/third_party/libwebrtc/modules/video_capture/linux/pipewire_session.cc +++ b/third_party/libwebrtc/modules/video_capture/linux/pipewire_session.cc @@ -68,8 +68,8 @@ PipeWireNode::PipeWireNode(PipeWireSession* session, } PipeWireNode::~PipeWireNode() { - pw_proxy_destroy(proxy_); spa_hook_remove(&node_listener_); + pw_proxy_destroy(proxy_); } // static diff --git a/third_party/libwebrtc/moz-patch-stack/caa8ef3ab5.no-op-cherry-pick-msg b/third_party/libwebrtc/moz-patch-stack/caa8ef3ab5.no-op-cherry-pick-msg new file mode 100644 index 000000000000..5a87865d6126 --- /dev/null +++ b/third_party/libwebrtc/moz-patch-stack/caa8ef3ab5.no-op-cherry-pick-msg @@ -0,0 +1,2 @@ +We cherry-picked this in bug 1942551. +