mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
tests: Add missing unrefs of objects after use
Unreffing the objects returned by gst_bin_get_by_name() and gst_pipeline_get_use() were missing in several tests, so add these. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734359
This commit is contained in:
parent
1da3df79cf
commit
9995054e80
9 changed files with 16 additions and 1 deletions
|
@ -150,6 +150,7 @@ on_source_message (GstBus * bus, GstMessage * message, ProgramData * data)
|
|||
source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
|
||||
fail_unless (gst_app_src_end_of_stream (GST_APP_SRC (source)) ==
|
||||
GST_FLOW_OK);
|
||||
gst_object_unref (source);
|
||||
break;
|
||||
case GST_MESSAGE_ERROR:
|
||||
g_main_loop_quit (data->loop);
|
||||
|
|
|
@ -24,6 +24,7 @@ on_new_sample_from_sink (GstElement * elt, ProgramData * data)
|
|||
GstSample *sample;
|
||||
GstBuffer *app_buffer, *buffer;
|
||||
GstElement *source;
|
||||
GstFlowReturn ret;
|
||||
|
||||
/* get the sample from appsink */
|
||||
sample = gst_app_sink_pull_sample (GST_APP_SINK (elt));
|
||||
|
@ -37,7 +38,10 @@ on_new_sample_from_sink (GstElement * elt, ProgramData * data)
|
|||
|
||||
/* get source an push new buffer */
|
||||
source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
|
||||
return gst_app_src_push_buffer (GST_APP_SRC (source), app_buffer);
|
||||
ret = gst_app_src_push_buffer (GST_APP_SRC (source), app_buffer);
|
||||
gst_object_unref (source);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* called when we get a GstMessage from the source pipeline when we get EOS, we
|
||||
|
@ -52,6 +56,7 @@ on_source_message (GstBus * bus, GstMessage * message, ProgramData * data)
|
|||
g_print ("The source got dry\n");
|
||||
source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
|
||||
gst_app_src_end_of_stream (GST_APP_SRC (source));
|
||||
gst_object_unref (source);
|
||||
break;
|
||||
case GST_MESSAGE_ERROR:
|
||||
g_print ("Received error\n");
|
||||
|
|
|
@ -206,6 +206,7 @@ main (int argc, char *argv[])
|
|||
gtk_main ();
|
||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||
gst_object_unref (pipeline);
|
||||
gst_object_unref (bus);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -170,6 +170,7 @@ main (int argc, char *argv[])
|
|||
gtk_main ();
|
||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||
gst_object_unref (pipeline);
|
||||
gst_object_unref (bus);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -214,6 +214,7 @@ do_switch (GstElement * pipeline)
|
|||
|
||||
/* set the active pad */
|
||||
g_object_set (select, "active-pad", pad, NULL);
|
||||
gst_object_unref (select);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -559,6 +559,8 @@ main (int argc, char **argv)
|
|||
g_print ("NULL pipeline\n");
|
||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||
|
||||
gst_object_unref (bus);
|
||||
|
||||
g_print ("free pipeline\n");
|
||||
gst_object_unref (pipeline);
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ main (int argc, char *argv[])
|
|||
/* get the preroll buffer from appsink, this block untils appsink really
|
||||
* prerolls */
|
||||
g_signal_emit_by_name (sink, "pull-preroll", &sample, NULL);
|
||||
gst_object_unref (sink);
|
||||
|
||||
/* if we have a buffer now, convert it to a pixbuf. It's possible that we
|
||||
* don't have a buffer because we went EOS right away or had an error. */
|
||||
|
|
|
@ -242,5 +242,7 @@ main (int argc, char **argv)
|
|||
|
||||
g_main_loop_unref (loop);
|
||||
|
||||
gst_object_unref (bus);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ test_textoverlay (int width, int height)
|
|||
}
|
||||
}
|
||||
|
||||
gst_object_unref (toverlay);
|
||||
g_free (pstr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue