Merge branch 'zbrown/mpris' into 'master'

m-mpris: ‘items’ is a GHashTable, not a GObject

See merge request pipewire/wireplumber!759
This commit is contained in:
Zander Brown 2025-12-15 21:22:48 +00:00
commit 596c886876

View file

@ -98,8 +98,10 @@ static void item_free (gpointer data)
{
Item *item = data;
free(item->desktop_entry);
free(item);
g_clear_pointer (&item->desktop_entry, g_free);
g_clear_pointer (&item->flatpak_app_id, g_free);
g_clear_pointer (&item->flatpak_instance_id, g_free);
g_free (item);
}
static Players *players_new (GDBusConnection *conn)
@ -128,7 +130,7 @@ static void players_unref (Players *players)
return;
g_mutex_clear (&players->lock);
g_clear_object (&players->items);
g_clear_pointer (&players->items, g_hash_table_unref);
g_clear_object (&players->conn);
g_clear_object (&players->cancellable);
g_free (players);
@ -170,8 +172,8 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ItemUpdate, item_update_free)
static void item_get_flatpak_app_id (ItemUpdate *update, Item *item)
{
spa_autofree char *app_id = NULL;
spa_autofree char *instance_id = NULL;
g_autofree char *app_id = NULL;
g_autofree char *instance_id = NULL;
int res;
g_clear_pointer (&item->flatpak_app_id, g_free);
@ -183,7 +185,7 @@ static void item_get_flatpak_app_id (ItemUpdate *update, Item *item)
res = pw_check_flatpak (item->pid, &app_id, &instance_id, NULL);
if (res < 0) {
wp_info ("%p: failed to get Flatpak status for '%s': %d (%s)", update->players, update->bus_name,
-res, spa_strerror (res));
-res, g_strerror (res));
return;
}
@ -236,7 +238,7 @@ static void item_desktop_entry_cb (GObject *source_object, GAsyncResult* res, gp
}
g_variant_get (result, "(v)", &value);
if (!g_str_equal(g_variant_get_type_string (value), "s")) {
if (!g_variant_is_of_type (value, G_VARIANT_TYPE_STRING)) {
wp_info ("%p: bad value for DesktopEntry for '%s'", update->players, update->bus_name);
return;
}
@ -426,6 +428,8 @@ wp_mpris_plugin_operation_finalize (GObject *object)
WpMprisPluginOperation *self = WP_MPRIS_PLUGIN_OPERATION (object);
g_clear_object (&self->conn);
G_OBJECT_CLASS (wp_mpris_plugin_operation_parent_class)->finalize (object);
}
static void
@ -529,9 +533,7 @@ wp_mpris_plugin_disable (WpPlugin * plugin)
static gpointer
wp_mpris_plugin_get_players (WpMprisPlugin *self)
{
g_auto (GVariantBuilder) b = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_ARRAY);
g_variant_builder_init (&b, G_VARIANT_TYPE ("av"));
g_auto (GVariantBuilder) b = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("av"));
if (self->players) {
g_autoptr (GMutexLocker) locker = g_mutex_locker_new (&self->players->lock);