mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 23:18:52 +00:00
validate: call gst_bus_remove_signal_watch()
We are supposed to call gst_bus_remove_signal_watch() for each gst_bus_add_signal_watch() call to prevent leaks.
This commit is contained in:
parent
6e776b8f0f
commit
a35614d108
4 changed files with 16 additions and 6 deletions
|
@ -95,6 +95,7 @@ static GPrivate main_thread_priv;
|
||||||
*/
|
*/
|
||||||
struct _GstValidateScenarioPrivate
|
struct _GstValidateScenarioPrivate
|
||||||
{
|
{
|
||||||
|
GstBus *bus;
|
||||||
GstValidateRunner *runner;
|
GstValidateRunner *runner;
|
||||||
gboolean execute_on_idle;
|
gboolean execute_on_idle;
|
||||||
|
|
||||||
|
@ -2102,6 +2103,12 @@ gst_validate_scenario_dispose (GObject * object)
|
||||||
(GWeakNotify) _pipeline_freed_cb, object);
|
(GWeakNotify) _pipeline_freed_cb, object);
|
||||||
g_list_free_full (priv->actions, (GDestroyNotify) gst_validate_action_unref);
|
g_list_free_full (priv->actions, (GDestroyNotify) gst_validate_action_unref);
|
||||||
|
|
||||||
|
if (priv->bus) {
|
||||||
|
gst_bus_remove_signal_watch (priv->bus);
|
||||||
|
gst_object_unref (priv->bus);
|
||||||
|
priv->bus = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (gst_validate_scenario_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gst_validate_scenario_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2176,7 +2183,6 @@ GstValidateScenario *
|
||||||
gst_validate_scenario_factory_create (GstValidateRunner *
|
gst_validate_scenario_factory_create (GstValidateRunner *
|
||||||
runner, GstElement * pipeline, const gchar * scenario_name)
|
runner, GstElement * pipeline, const gchar * scenario_name)
|
||||||
{
|
{
|
||||||
GstBus *bus;
|
|
||||||
GstValidateScenario *scenario =
|
GstValidateScenario *scenario =
|
||||||
g_object_new (GST_TYPE_VALIDATE_SCENARIO, "validate-runner",
|
g_object_new (GST_TYPE_VALIDATE_SCENARIO, "validate-runner",
|
||||||
runner, NULL);
|
runner, NULL);
|
||||||
|
@ -2197,10 +2203,10 @@ gst_validate_scenario_factory_create (GstValidateRunner *
|
||||||
g_signal_connect (pipeline, "element-added", (GCallback) _element_added_cb,
|
g_signal_connect (pipeline, "element-added", (GCallback) _element_added_cb,
|
||||||
scenario);
|
scenario);
|
||||||
|
|
||||||
bus = gst_element_get_bus (pipeline);
|
scenario->priv->bus = gst_element_get_bus (pipeline);
|
||||||
gst_bus_add_signal_watch (bus);
|
gst_bus_add_signal_watch (scenario->priv->bus);
|
||||||
g_signal_connect (bus, "message", (GCallback) message_cb, scenario);
|
g_signal_connect (scenario->priv->bus, "message", (GCallback) message_cb,
|
||||||
gst_object_unref (bus);
|
scenario);
|
||||||
|
|
||||||
if (scenario->priv->handles_state) {
|
if (scenario->priv->handles_state) {
|
||||||
GST_INFO_OBJECT (scenario, "Scenario handles state,"
|
GST_INFO_OBJECT (scenario, "Scenario handles state,"
|
||||||
|
|
|
@ -495,6 +495,7 @@ _run_frame_analisis (GstMediaDescriptorWriter * writer,
|
||||||
writer->priv->pipeline = NULL;
|
writer->priv->pipeline = NULL;
|
||||||
g_main_loop_unref (writer->priv->loop);
|
g_main_loop_unref (writer->priv->loop);
|
||||||
writer->priv->loop = NULL;
|
writer->priv->loop = NULL;
|
||||||
|
gst_bus_remove_signal_watch (bus);
|
||||||
gst_object_unref (bus);
|
gst_object_unref (bus);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -918,7 +918,6 @@ main (int argc, gchar ** argv)
|
||||||
bus = gst_element_get_bus (pipeline);
|
bus = gst_element_get_bus (pipeline);
|
||||||
gst_bus_add_signal_watch (bus);
|
gst_bus_add_signal_watch (bus);
|
||||||
g_signal_connect (bus, "message", (GCallback) bus_callback, mainloop);
|
g_signal_connect (bus, "message", (GCallback) bus_callback, mainloop);
|
||||||
gst_object_unref (bus);
|
|
||||||
|
|
||||||
g_print ("Starting pipeline\n");
|
g_print ("Starting pipeline\n");
|
||||||
sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
@ -946,6 +945,9 @@ main (int argc, gchar ** argv)
|
||||||
ret = rep_err;
|
ret = rep_err;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
gst_bus_remove_signal_watch (bus);
|
||||||
|
gst_object_unref (bus);
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
g_main_loop_unref (mainloop);
|
g_main_loop_unref (mainloop);
|
||||||
g_object_unref (pipeline);
|
g_object_unref (pipeline);
|
||||||
|
|
|
@ -605,6 +605,7 @@ main (int argc, gchar ** argv)
|
||||||
|
|
||||||
/* Clean the bus */
|
/* Clean the bus */
|
||||||
gst_bus_set_flushing (bus, TRUE);
|
gst_bus_set_flushing (bus, TRUE);
|
||||||
|
gst_bus_remove_signal_watch (bus);
|
||||||
gst_object_unref (bus);
|
gst_object_unref (bus);
|
||||||
|
|
||||||
rep_err = gst_validate_runner_printf (runner);
|
rep_err = gst_validate_runner_printf (runner);
|
||||||
|
|
Loading…
Reference in a new issue