gst/gst.c: declare gst initialized before eventually rebuilding the registry.

Original commit message from CVS:
* gst/gst.c: (gst_init_check_with_popt_table), (init_post),
(init_popt_callback):
declare gst initialized before eventually rebuilding the registry.
Fixes issues with plugins calling gst_init
* gst/gstelementfactory.c: (gst_element_factory_cleanup),
(gst_element_register), (gst_element_factory_unload_thyself):
warn and fail properly when element details aren't initialized. Also
unref the class when we don't need it anymore instead of never/only
on failure
This commit is contained in:
Benjamin Otte 2005-04-22 23:53:32 +00:00
parent 20e6e96160
commit 3bef22d727
3 changed files with 19 additions and 4 deletions

View file

@ -1,3 +1,15 @@
2005-04-23 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/gst.c: (gst_init_check_with_popt_table), (init_post),
(init_popt_callback):
declare gst initialized before eventually rebuilding the registry.
Fixes issues with plugins calling gst_init
* gst/gstelementfactory.c: (gst_element_factory_cleanup),
(gst_element_register), (gst_element_factory_unload_thyself):
warn and fail properly when element details aren't initialized. Also
unref the class when we don't need it anymore instead of never/only
on failure
2005-04-22 Wouter Paesen <wouter@kangaroot.net>
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>

View file

@ -344,7 +344,6 @@ gst_init_check_with_popt_table (int *argc, char **argv[],
return FALSE;
if (!init_post ())
return FALSE;
gst_initialized = TRUE;
return TRUE;
}
@ -616,6 +615,7 @@ init_post (void)
_gst_buffer_initialize ();
_gst_tag_initialize ();
gst_initialized = TRUE;
#ifndef GST_DISABLE_REGISTRY
if (!_gst_registry_fixed) {
/* don't override command-line options */
@ -806,7 +806,6 @@ init_popt_callback (poptContext context, enum poptCallbackReason reason,
case POPT_CALLBACK_REASON_POST:
if (!init_post ())
_gst_initialization_failure = TRUE;
gst_initialized = TRUE;
break;
}
}

View file

@ -170,7 +170,6 @@ gst_element_factory_cleanup (GstElementFactory * factory)
{
__gst_element_details_clear (&factory->details);
if (factory->type) {
g_type_class_unref (g_type_class_peek (factory->type));
factory->type = 0;
}
@ -231,6 +230,10 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
factory->type = type;
if (!GST_IS_ELEMENT_DETAILS (&klass->details)) {
g_warning ("invalid element details in class %s", g_type_name (type));
goto error;
}
__gst_element_details_copy (&factory->details, &klass->details);
factory->padtemplates = g_list_copy (klass->padtemplates);
g_list_foreach (factory->padtemplates, (GFunc) gst_object_ref, NULL);
@ -260,10 +263,12 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank);
g_type_class_unref (klass);
return TRUE;
error:
gst_element_factory_cleanup (factory);
g_type_class_unref (klass);
return FALSE;
}
@ -622,7 +627,6 @@ gst_element_factory_unload_thyself (GstPluginFeature * feature)
factory = GST_ELEMENT_FACTORY (feature);
if (factory->type) {
g_type_class_unref (g_type_class_peek (factory->type));
factory->type = 0;
}
}