mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 17:05:52 +00:00
gst/gstelementfactory.c: If the GstElementClass doesn't have a GstElementDetails with all fields then error out nicel...
Original commit message from CVS: * gst/gstelementfactory.c: (gst_element_register): If the GstElementClass doesn't have a GstElementDetails with all fields filled up correctly (longname, description AND author), then error out nicely instead of crashing.
This commit is contained in:
parent
5f0bc06ae1
commit
b2bfb935b2
2 changed files with 23 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2006-08-14 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
|
* gst/gstelementfactory.c: (gst_element_register):
|
||||||
|
If the GstElementClass doesn't have a GstElementDetails with all fields
|
||||||
|
filled up correctly (longname, description AND author), then error out
|
||||||
|
nicely instead of crashing.
|
||||||
|
|
||||||
2006-08-14 Tim-Philipp Müller <tim at centricular dot net>
|
2006-08-14 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* gst/gststructure.c:
|
* gst/gststructure.c:
|
||||||
|
|
|
@ -271,6 +271,10 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
|
||||||
g_type_name (type));
|
g_type_name (type));
|
||||||
|
|
||||||
klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
|
klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
|
||||||
|
if ((klass->details.longname == NULL) ||
|
||||||
|
(klass->details.klass == NULL) || (klass->details.author == NULL))
|
||||||
|
goto detailserror;
|
||||||
|
|
||||||
factory->type = type;
|
factory->type = type;
|
||||||
__gst_element_details_copy (&factory->details, &klass->details);
|
__gst_element_details_copy (&factory->details, &klass->details);
|
||||||
for (item = klass->padtemplates; item; item = item->next) {
|
for (item = klass->padtemplates; item; item = item->next) {
|
||||||
|
@ -294,13 +298,13 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
|
||||||
g_type_interface_peek (klass, GST_TYPE_URI_HANDLER);
|
g_type_interface_peek (klass, GST_TYPE_URI_HANDLER);
|
||||||
|
|
||||||
if (!iface || !iface->get_type || !iface->get_protocols)
|
if (!iface || !iface->get_type || !iface->get_protocols)
|
||||||
goto error;
|
goto urierror;
|
||||||
factory->uri_type = iface->get_type ();
|
factory->uri_type = iface->get_type ();
|
||||||
if (!GST_URI_TYPE_IS_VALID (factory->uri_type))
|
if (!GST_URI_TYPE_IS_VALID (factory->uri_type))
|
||||||
goto error;
|
goto urierror;
|
||||||
factory->uri_protocols = g_strdupv (iface->get_protocols ());
|
factory->uri_protocols = g_strdupv (iface->get_protocols ());
|
||||||
if (!factory->uri_protocols)
|
if (!factory->uri_protocols)
|
||||||
goto error;
|
goto urierror;
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaces = g_type_interfaces (type, &n_interfaces);
|
interfaces = g_type_interfaces (type, &n_interfaces);
|
||||||
|
@ -319,12 +323,20 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
error:
|
urierror:
|
||||||
{
|
{
|
||||||
GST_WARNING_OBJECT (factory, "error with uri handler!");
|
GST_WARNING_OBJECT (factory, "error with uri handler!");
|
||||||
gst_element_factory_cleanup (factory);
|
gst_element_factory_cleanup (factory);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detailserror:
|
||||||
|
{
|
||||||
|
GST_WARNING_OBJECT (factory,
|
||||||
|
"The GstElementDetails don't seem to have been set properly");
|
||||||
|
gst_element_factory_cleanup (factory);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue