glsinkbin: Check sink property exists before attempting to read it

The same is done in the set_property function. This was noticed when attempting
to dump a pipeline containing glsinkbin sink=gtk4paintablesink to dot format.
Critical warnings were raised due to the missing force-aspect-ratio property on
that sink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5311>
This commit is contained in:
Philippe Normand 2023-09-10 17:05:00 +01:00 committed by GStreamer Marge Bot
parent 003e419ff5
commit ce7b2af414

View file

@ -381,6 +381,7 @@ gst_gl_sink_bin_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstGLSinkBin *self = GST_GL_SINK_BIN (object);
GParamSpec *sink_pspec;
switch (prop_id) {
case PROP_SINK:
@ -394,8 +395,17 @@ gst_gl_sink_bin_get_property (GObject * object, guint prop_id,
g_object_get_property (G_OBJECT (self->balance), pspec->name, value);
break;
default:
if (self->sink)
g_object_get_property (G_OBJECT (self->sink), pspec->name, value);
if (self->sink) {
sink_pspec =
g_object_class_find_property (G_OBJECT_GET_CLASS (self->sink),
pspec->name);
if (sink_pspec
&& G_PARAM_SPEC_TYPE (sink_pspec) == G_PARAM_SPEC_TYPE (pspec)) {
g_object_get_property (G_OBJECT (self->sink), pspec->name, value);
} else {
GST_INFO ("Failed to get unmatched property %s", pspec->name);
}
}
break;
}
}