Skip to content
Snippets Groups Projects
Commit ecad76d9 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

policy: consume floating reference of GVariant in _find_endpoint()

parent 52273e99
No related branches found
No related tags found
No related merge requests found
...@@ -346,7 +346,7 @@ wp_policy_notify_changed (WpPolicy *self) ...@@ -346,7 +346,7 @@ wp_policy_notify_changed (WpPolicy *self)
/** /**
* wp_policy_find_endpoint: * wp_policy_find_endpoint:
* @core: the #WpCore * @core: the #WpCore
* @props: properties of the lookup * @props: (transfer floating): properties of the lookup
* @stream_id: (out): the relevant stream id of the returned endpoint * @stream_id: (out): the relevant stream id of the returned endpoint
* *
* Calls #WpPolicyClass::find_endpoint on all policies, in order, until * Calls #WpPolicyClass::find_endpoint on all policies, in order, until
...@@ -378,5 +378,8 @@ wp_policy_find_endpoint (WpCore *core, GVariant *props, ...@@ -378,5 +378,8 @@ wp_policy_find_endpoint (WpCore *core, GVariant *props,
} }
} }
if (g_variant_is_floating (props))
g_variant_unref (props);
return NULL; return NULL;
} }
...@@ -26,7 +26,6 @@ simple_policy_handle_endpoint (WpPolicy *policy, WpEndpoint *ep) ...@@ -26,7 +26,6 @@ simple_policy_handle_endpoint (WpPolicy *policy, WpEndpoint *ep)
{ {
const char *media_class = NULL; const char *media_class = NULL;
GVariantDict d; GVariantDict d;
g_autoptr (GVariant) props = NULL;
g_autoptr (WpCore) core = NULL; g_autoptr (WpCore) core = NULL;
g_autoptr (WpEndpoint) target = NULL; g_autoptr (WpEndpoint) target = NULL;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
...@@ -42,10 +41,9 @@ simple_policy_handle_endpoint (WpPolicy *policy, WpEndpoint *ep) ...@@ -42,10 +41,9 @@ simple_policy_handle_endpoint (WpPolicy *policy, WpEndpoint *ep)
g_variant_dict_insert (&d, "action", "s", "link"); g_variant_dict_insert (&d, "action", "s", "link");
g_variant_dict_insert (&d, "media.class", "s", "Audio/Sink"); g_variant_dict_insert (&d, "media.class", "s", "Audio/Sink");
/* TODO: more properties are needed here */ /* TODO: more properties are needed here */
props = g_variant_dict_end (&d);
core = wp_policy_get_core (policy); core = wp_policy_get_core (policy);
target = wp_policy_find_endpoint (core, props, &stream_id); target = wp_policy_find_endpoint (core, g_variant_dict_end (&d), &stream_id);
if (!target) { if (!target) {
g_warning ("Could not find an Audio/Sink target endpoint\n"); g_warning ("Could not find an Audio/Sink target endpoint\n");
/* TODO: we should kill the client, otherwise it's going to hang waiting */ /* TODO: we should kill the client, otherwise it's going to hang waiting */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment