mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
parser: Make sure that signal user data is freed by setting a GClosureNotify
...instead of using a second mechanism and storing the user data inside the GObjects qdata.
This commit is contained in:
parent
02d044e291
commit
28493b04ec
1 changed files with 13 additions and 15 deletions
|
@ -303,9 +303,6 @@ static void gst_parse_new_child(GstChildProxy *child_proxy, GObject *object,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_signal_handler_disconnect (child_proxy, set->signal_id);
|
g_signal_handler_disconnect (child_proxy, set->signal_id);
|
||||||
g_free(set->name);
|
|
||||||
g_free(set->value_str);
|
|
||||||
g_slice_free(DelayedSet, set);
|
|
||||||
if (!got_value)
|
if (!got_value)
|
||||||
goto error;
|
goto error;
|
||||||
g_object_set_property (G_OBJECT (target), pspec->name, &v);
|
g_object_set_property (G_OBJECT (target), pspec->name, &v);
|
||||||
|
@ -324,6 +321,12 @@ error:
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_parse_free_delayed_set (DelayedSet *set) {
|
||||||
|
g_free(set->name);
|
||||||
|
g_free(set->value_str);
|
||||||
|
g_slice_free(DelayedSet, set);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
|
gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
|
||||||
|
@ -386,7 +389,9 @@ gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
|
||||||
data->parent = element;
|
data->parent = element;
|
||||||
data->name = g_strdup(value);
|
data->name = g_strdup(value);
|
||||||
data->value_str = g_strdup(pos);
|
data->value_str = g_strdup(pos);
|
||||||
data->signal_id = g_signal_connect(element, "child-added", G_CALLBACK (gst_parse_new_child), data);
|
data->signal_id = g_signal_connect_data(element, "child-added",
|
||||||
|
G_CALLBACK (gst_parse_new_child), data, (GClosureNotify)
|
||||||
|
gst_parse_free_delayed_set, (GConnectFlags) 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_PROPERTY, \
|
SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_PROPERTY, \
|
||||||
|
@ -434,15 +439,12 @@ gst_parse_free_delayed_link (DelayedLink *link)
|
||||||
static void
|
static void
|
||||||
gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data)
|
gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data)
|
||||||
{
|
{
|
||||||
DelayedLink *link = g_object_get_qdata (G_OBJECT (src),
|
DelayedLink *link = data;
|
||||||
g_quark_from_static_string ("GstParseDelayedLink"));
|
|
||||||
|
|
||||||
GST_CAT_INFO (GST_CAT_PIPELINE, "trying delayed linking %s:%s to %s:%s",
|
GST_CAT_INFO (GST_CAT_PIPELINE, "trying delayed linking %s:%s to %s:%s",
|
||||||
GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
|
GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
|
||||||
GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
|
GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
|
||||||
|
|
||||||
g_return_if_fail (link != NULL);
|
|
||||||
|
|
||||||
if (gst_element_link_pads_filtered (src, link->src_pad, link->sink,
|
if (gst_element_link_pads_filtered (src, link->src_pad, link->sink,
|
||||||
link->sink_pad, link->caps)) {
|
link->sink_pad, link->caps)) {
|
||||||
/* do this here, we don't want to get any problems later on when
|
/* do this here, we don't want to get any problems later on when
|
||||||
|
@ -451,8 +453,6 @@ gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data)
|
||||||
GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
|
GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
|
||||||
GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
|
GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
|
||||||
g_signal_handler_disconnect (src, link->signal_id);
|
g_signal_handler_disconnect (src, link->signal_id);
|
||||||
g_object_set_qdata (G_OBJECT (src),
|
|
||||||
g_quark_from_static_string ("GstParseDelayedLink"), NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* both padnames and the caps may be NULL */
|
/* both padnames and the caps may be NULL */
|
||||||
|
@ -485,11 +485,9 @@ gst_parse_perform_delayed_link (GstElement *src, const gchar *src_pad,
|
||||||
} else {
|
} else {
|
||||||
data->caps = NULL;
|
data->caps = NULL;
|
||||||
}
|
}
|
||||||
g_object_set_qdata_full (G_OBJECT (src),
|
data->signal_id = g_signal_connect_data (src, "pad-added",
|
||||||
g_quark_from_static_string ("GstParseDelayedLink"), data,
|
G_CALLBACK (gst_parse_found_pad), data,
|
||||||
(GDestroyNotify)gst_parse_free_delayed_link);
|
(GClosureNotify) gst_parse_free_delayed_link, (GConnectFlags) 0);
|
||||||
data->signal_id = g_signal_connect (src, "pad-added",
|
|
||||||
G_CALLBACK (gst_parse_found_pad), NULL);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue