tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d0bbf7f4225beefda364d09b90128c4a99694c3f
parent 9b6eb9c7f99ae18c2c353feb4fbc65da39ec3ef4
Author: Jan Grulich <jgrulich@redhat.com>
Date:   Fri, 24 Oct 2025 06:49:01 +0000

Bug 1996050 - Fix undefined g_unix_fd_list_get symbol for '--with-system-pipewire' option r=stransky

Split the definition of g_unix_fd_list_get() symbol from the rest of
PipeWire symbols and use it for both build options when Firefox is
built with or without system PipeWire.

Differential Revision: https://phabricator.services.mozilla.com/D269787

Diffstat:
Mthird_party/pipewire/libpipewire/moz.build | 1+
Athird_party/pipewire/libpipewire/mozgio.cpp | 42++++++++++++++++++++++++++++++++++++++++++
Mthird_party/pipewire/libpipewire/mozpipewire.cpp | 29-----------------------------
3 files changed, 43 insertions(+), 29 deletions(-)

diff --git a/third_party/pipewire/libpipewire/moz.build b/third_party/pipewire/libpipewire/moz.build @@ -7,6 +7,7 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": CXXFLAGS += CONFIG['MOZ_GTK3_CFLAGS'] +SOURCES += ['mozgio.cpp'] if CONFIG["MOZ_SYSTEM_PIPEWIRE"]: OS_LIBS += CONFIG["MOZ_PIPEWIRE_LIBS"] else: diff --git a/third_party/pipewire/libpipewire/mozgio.cpp b/third_party/pipewire/libpipewire/mozgio.cpp @@ -0,0 +1,42 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:expandtab:shiftwidth=4:tabstop=4: + */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include <glib.h> +#include "mozilla/Types.h" +#include "prlink.h" + +#define GET_FUNC(func, lib) \ + func##_fn = \ + (decltype(func##_fn))PR_FindFunctionSymbol(lib, #func) \ + +struct GUnixFDList; + +extern "C" gint +g_unix_fd_list_get(struct GUnixFDList *list, + gint index_, + GError **error) +{ + static PRLibrary* gioLib = nullptr; + static bool gioInitialized = false; + static gint (*g_unix_fd_list_get_fn)(struct GUnixFDList *list, + gint index_, GError **error) = nullptr; + + if (!gioInitialized) { + gioInitialized = true; + gioLib = PR_LoadLibrary("libgio-2.0.so.0"); + if (!gioLib) { + return -1; + } + GET_FUNC(g_unix_fd_list_get, gioLib); + } + + if (!g_unix_fd_list_get_fn) { + return -1; + } + + return g_unix_fd_list_get_fn(list, index_, error); +} diff --git a/third_party/pipewire/libpipewire/mozpipewire.cpp b/third_party/pipewire/libpipewire/mozpipewire.cpp @@ -5,7 +5,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <glib.h> #include "mozilla/Types.h" #include "prlink.h" @@ -18,34 +17,6 @@ #define IS_FUNC_LOADED(func) \ (func != nullptr) \ -struct GUnixFDList; - -extern "C" gint -g_unix_fd_list_get(struct GUnixFDList *list, - gint index_, - GError **error) -{ - static PRLibrary* gioLib = nullptr; - static bool gioInitialized = false; - static gint (*g_unix_fd_list_get_fn)(struct GUnixFDList *list, - gint index_, GError **error) = nullptr; - - if (!gioInitialized) { - gioInitialized = true; - gioLib = PR_LoadLibrary("libgio-2.0.so.0"); - if (!gioLib) { - return -1; - } - GET_FUNC(g_unix_fd_list_get, gioLib); - } - - if (!g_unix_fd_list_get_fn) { - return -1; - } - - return g_unix_fd_list_get_fn(list, index_, error); -} - static struct pw_core * (*pw_context_connect_fn)(struct pw_context *context, struct pw_properties *properties, size_t user_data_size);