mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 13:25:56 +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
|
||||
{
|
||||
GstBus *bus;
|
||||
GstValidateRunner *runner;
|
||||
gboolean execute_on_idle;
|
||||
|
||||
|
@ -2102,6 +2103,12 @@ gst_validate_scenario_dispose (GObject * object)
|
|||
(GWeakNotify) _pipeline_freed_cb, object);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -2176,7 +2183,6 @@ GstValidateScenario *
|
|||
gst_validate_scenario_factory_create (GstValidateRunner *
|
||||
runner, GstElement * pipeline, const gchar * scenario_name)
|
||||
{
|
||||
GstBus *bus;
|
||||
GstValidateScenario *scenario =
|
||||
g_object_new (GST_TYPE_VALIDATE_SCENARIO, "validate-runner",
|
||||
runner, NULL);
|
||||
|
@ -2197,10 +2203,10 @@ gst_validate_scenario_factory_create (GstValidateRunner *
|
|||
g_signal_connect (pipeline, "element-added", (GCallback) _element_added_cb,
|
||||
scenario);
|
||||
|
||||
bus = gst_element_get_bus (pipeline);
|
||||
gst_bus_add_signal_watch (bus);
|
||||
g_signal_connect (bus, "message", (GCallback) message_cb, scenario);
|
||||
gst_object_unref (bus);
|
||||
scenario->priv->bus = gst_element_get_bus (pipeline);
|
||||
gst_bus_add_signal_watch (scenario->priv->bus);
|
||||
g_signal_connect (scenario->priv->bus, "message", (GCallback) message_cb,
|
||||
scenario);
|
||||
|
||||
if (scenario->priv->handles_state) {
|
||||
GST_INFO_OBJECT (scenario, "Scenario handles state,"
|
||||
|
|
|
@ -495,6 +495,7 @@ _run_frame_analisis (GstMediaDescriptorWriter * writer,
|
|||
writer->priv->pipeline = NULL;
|
||||
g_main_loop_unref (writer->priv->loop);
|
||||
writer->priv->loop = NULL;
|
||||
gst_bus_remove_signal_watch (bus);
|
||||
gst_object_unref (bus);
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -918,7 +918,6 @@ main (int argc, gchar ** argv)
|
|||
bus = gst_element_get_bus (pipeline);
|
||||
gst_bus_add_signal_watch (bus);
|
||||
g_signal_connect (bus, "message", (GCallback) bus_callback, mainloop);
|
||||
gst_object_unref (bus);
|
||||
|
||||
g_print ("Starting pipeline\n");
|
||||
sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
|
@ -946,6 +945,9 @@ main (int argc, gchar ** argv)
|
|||
ret = rep_err;
|
||||
|
||||
exit:
|
||||
gst_bus_remove_signal_watch (bus);
|
||||
gst_object_unref (bus);
|
||||
|
||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||
g_main_loop_unref (mainloop);
|
||||
g_object_unref (pipeline);
|
||||
|
|
|
@ -605,6 +605,7 @@ main (int argc, gchar ** argv)
|
|||
|
||||
/* Clean the bus */
|
||||
gst_bus_set_flushing (bus, TRUE);
|
||||
gst_bus_remove_signal_watch (bus);
|
||||
gst_object_unref (bus);
|
||||
|
||||
rep_err = gst_validate_runner_printf (runner);
|
||||
|
|
Loading…
Reference in a new issue