[gst-cvs] CVS: gstreamer/gst/autoplug gststaticautoplug.c,1.9,1.10

Andy Wingo wingo at users.sourceforge.net
Sat Nov 24 12:38:01 PST 2001


Update of /cvsroot/gstreamer/gstreamer/gst/autoplug
In directory usw-pr-cvs1:/tmp/cvs-serv9415/autoplug

Modified Files:
	gststaticautoplug.c 
Log Message:
quoting from the comment i put in gststaticautoplug.c:

it is likely that the plugin is not loaded yet. thus when it loads it
will replace the elementfactory that gst built from the cache, and the
GST_OBJECT_NAME will no longer be valid. thus we must g_strdup its name.

this might be an implementation problem, i don't know, if a program keeps
a reference to a cached factory after a factory has been added on plugin
initialization. i really don't know though.


Index: gststaticautoplug.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/autoplug/gststaticautoplug.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- gststaticautoplug.c	2001/08/21 20:16:45	1.9
+++ gststaticautoplug.c	2001/11/24 20:37:40	1.10
@@ -354,6 +354,7 @@
   while (factories[0]) {
     GstElementFactory *factory;
     GstElement *element;
+    gchar *name;
 
     // fase 3: add common elements
     factory = (GstElementFactory *) (factories[0]->data);
@@ -366,8 +367,18 @@
     }
 
     GST_DEBUG (0,"common factory \"%s\"\n", GST_OBJECT_NAME (factory));
-
-    element = gst_elementfactory_create (factory, GST_OBJECT_NAME (factory));
+    
+    /* it is likely that the plugin is not loaded yet. thus when it loads it
+     * will replace the elementfactory that gst built from the cache, and the
+     * GST_OBJECT_NAME will no longer be valid. thus we must g_strdup its name.
+     *
+     * this might be an implementation problem, i don't know, if a program keeps
+     * a reference to a cached factory after a factory has been added on plugin
+     * initialization. i raelly don't know though.
+     */
+    name = g_strdup (GST_OBJECT_NAME (factory));
+    element = gst_elementfactory_create (factory, name);
+    g_free(name);
     gst_bin_add (GST_BIN(result), element);
 
     if (srcelement != NULL) {





More information about the Gstreamer-commits mailing list