Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build with pipewire 1.3.82 #1624

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

antlarr-suse
Copy link

While submitting pipewire 1.3.82 to openSUSE Tumbleweed I noticed this cast is needed to build xdg-desktop-portal. This was already submitted as an issue in #1611 in Debian testing, in which the reporter doesn't mention the used pipewire version but says "I am also building my own pipewire" so I guess it's one of the latest RCs (1.3.81 or 1.3.82).

Fixes: #1611

@swick
Copy link
Contributor

swick commented Feb 12, 2025

Thanks for the fix, that looks correct.

I think the better way here however would be to store the registry as the type it actually is (struct pw_registry) in PipeWireRemote and then cast to struct pw_proxy on demand.

Do you want to update the patch accordingly or do you want me to take over?

@antlarr-suse
Copy link
Author

I think the better way here however would be to store the registry as the type it actually is (struct pw_registry) in PipeWireRemote and then cast to struct pw_proxy on demand.

Yes, I also thought of that, but I wasn't sure if you'd prefer that and this way it was just a one-liner.

Do you want to update the patch accordingly or do you want me to take over?

Sure, I'll update it.

While submitting pipewire 1.3.82 to openSUSE Tumbleweed I noticed this
is needed to build xdg-desktop-portal. This was already submitted
as an issue in flatpak#1611 in Debian, in which the reporter doesn't mention the
used pipewire version but says "I am also building my own pipewire"
so I guess it's one of the latest RCs (1.3.81 or 1.3.82).

Fixes: flatpak#1611
@antlarr-suse antlarr-suse force-pushed the fix-build-pipewire-1.3.82 branch from 2684fe3 to da7b73b Compare February 12, 2025 12:35
@smcv smcv added this pull request to the merge queue Feb 12, 2025
Merged via the queue into flatpak:main with commit da7b73b Feb 12, 2025
10 checks passed
@antlarr-suse
Copy link
Author

Hi, I just noticed that I force pushed the same commit instead of the requested changes that I had already prepared:

diff --git a/src/pipewire.c b/src/pipewire.c
index 39b05c7..7b8d104 100644
--- a/src/pipewire.c
+++ b/src/pipewire.c
@@ -224,7 +224,8 @@ pipewire_remote_destroy (PipeWireRemote *remote)
   /* This check is a workaround for older PW versions */
   if (remote->registry)
     spa_hook_remove (&remote->registry_listener);
-  g_clear_pointer (&remote->registry, pw_proxy_destroy);
+  pw_proxy_destroy((struct pw_proxy *)remote->registry);
+  remote->registry = NULL;
   g_clear_pointer (&remote->globals, g_hash_table_destroy);
   if (remote->core)
     spa_hook_remove (&remote->core_listener);
@@ -328,10 +329,10 @@ pipewire_remote_new_sync (struct pw_properties *pipewire_properties,
                         &core_events,
                         remote);
 
-  remote->registry = (struct pw_proxy*) pw_core_get_registry (remote->core,
-                                                              PW_VERSION_REGISTRY,
-                                                              0);
-  pw_registry_add_listener ((struct pw_registry*)remote->registry,
+  remote->registry = pw_core_get_registry (remote->core,
+                                           PW_VERSION_REGISTRY,
+                                           0);
+  pw_registry_add_listener (remote->registry,
                             &remote->registry_listener,
                             &registry_events,
                             remote);
diff --git a/src/pipewire.h b/src/pipewire.h
index f861449..354f8a1 100644
--- a/src/pipewire.h
+++ b/src/pipewire.h
@@ -53,7 +53,7 @@ struct _PipeWireRemote
 
   int sync_seq;
 
-  struct pw_proxy *registry;
+  struct pw_registry *registry;
   struct spa_hook registry_listener;
 
   GHashTable *globals;

@smcv , @swick, Should I open another PR with those changes or is the merged one ok?

@GeorgesStavracas
Copy link
Member

A separate PR is fine

antlarr-suse pushed a commit to antlarr-suse/xdg-desktop-portal that referenced this pull request Feb 12, 2025
This is a better fix for flatpak#1611 and an improvement over flatpak#1624
as requested by @swick.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xdg-desktop-portal fails to compile on Debian Testing
5 participants