gst/gstplugin.c: Print error debug message if plugin description fields that should be set are NULL.

Original commit message from CVS:
* gst/gstplugin.c: (CHECK_PLUGIN_DESC_FIELD), (gst_plugin_load_file):
Print error debug message if plugin description fields that should
be set are NULL.
* gst/gstregistrybinary.c: (gst_registry_binary_save_const_string):
Don't crash if the string to serialise is NULL (it really should
not be, but apparently this used to work with the xml registry ...).
This commit is contained in:
Tim-Philipp Müller 2008-07-02 14:43:40 +00:00
parent 78bb15ec47
commit 944de3aa68
3 changed files with 30 additions and 0 deletions

View file

@ -1,3 +1,13 @@
2008-07-02 Tim-Philipp Müller <tim.muller at collabora co uk>
* gst/gstplugin.c: (CHECK_PLUGIN_DESC_FIELD), (gst_plugin_load_file):
Print error debug message if plugin description fields that should
be set are NULL.
* gst/gstregistrybinary.c: (gst_registry_binary_save_const_string):
Don't crash if the string to serialise is NULL (it really should
not be, but apparently this used to work with the xml registry ...).
2008-07-02 Thijs Vermeir <thijsvermeir@gmail.com>
* tools/gst-plot-timeline.py:

View file

@ -430,6 +430,11 @@ static void _gst_plugin_fault_handler_setup ();
static GStaticMutex gst_plugin_loading_mutex = G_STATIC_MUTEX_INIT;
#define CHECK_PLUGIN_DESC_FIELD(desc,field,fn) \
if (G_UNLIKELY ((desc)->field == NULL)) { \
GST_ERROR ("GstPluginDesc for '%s' has no %s", fn, G_STRINGIFY (field)); \
}
/**
* gst_plugin_load_file:
* @filename: the plugin filename to load
@ -520,6 +525,16 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
}
plugin->orig_desc = (GstPluginDesc *) ptr;
/* check plugin description: complain about bad values but accept them, to
* maintain backwards compatibility (FIXME: 0.11) */
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, name, filename);
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, description, filename);
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, version, filename);
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, license, filename);
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, source, filename);
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, package, filename);
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, origin, filename);
GST_LOG ("Plugin %p for file \"%s\" prepared, calling entry function...",
plugin, filename);

View file

@ -291,6 +291,11 @@ gst_registry_binary_save_const_string (GList ** list, const gchar * str)
{
GstBinaryChunk *chunk;
if (G_UNLIKELY (str == NULL)) {
GST_ERROR ("unexpected NULL string in plugin or plugin feature data");
str = "";
}
chunk = g_malloc (sizeof (GstBinaryChunk));
chunk->data = (gpointer) str;
chunk->size = strlen ((gchar *) chunk->data) + 1;