gst/gst.c: Ignore EINTR when reading from the child registry pipe.
authorJan Schmidt <thaytan@mad.scientist.com>
Sat, 9 Dec 2006 18:48:57 +0000 (18:48 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Sat, 9 Dec 2006 18:48:57 +0000 (18:48 +0000)
Original commit message from CVS:
* gst/gst.c: (ensure_current_registry_forking):
Ignore EINTR when reading from the child registry pipe.
Explicitly ignore the return value from close, since it makes no
difference.
* gst/gstminiobject.c: (gst_mini_object_ref),
(gst_mini_object_unref):
When debugging refcounts, check GST_IS_MINI_OBJECT and warn.
* gst/gstregistry.c: (_priv_gst_registry_remove_cache_plugins):
When removing cached plugins, remove their features too, so they're
not visible after they've disappeared.
* gst/gstutils.c: (prepare_link_maybe_ghosting):
In the unlikely case that we are linking pads with no parents, don't
crash trying to get the non-existent parent bin.
* gst/parse/grammar.y:
Output debug in the PIPELINE category

ChangeLog
gst/gst.c
gst/gstminiobject.c
gst/gstregistry.c
gst/gstutils.c
gst/parse/grammar.y

index 129589c..b24d737 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2006-12-09  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * gst/gst.c: (ensure_current_registry_forking):
+       Ignore EINTR when reading from the child registry pipe.
+       Explicitly ignore the return value from close, since it makes no
+       difference.
+
+       * gst/gstminiobject.c: (gst_mini_object_ref),
+       (gst_mini_object_unref):
+       When debugging refcounts, check GST_IS_MINI_OBJECT and warn.
+
+       * gst/gstregistry.c: (_priv_gst_registry_remove_cache_plugins):
+       When removing cached plugins, remove their features too, so they're
+       not visible after they've disappeared.
+
+       * gst/gstutils.c: (prepare_link_maybe_ghosting):
+       In the unlikely case that we are linking pads with no parents, don't
+       crash trying to get the non-existent parent bin.
+
+       * gst/parse/grammar.y:
+       Output debug in the PIPELINE category
+
 2005-03-08  Wim Taymans  <wim@fluendo.com>
 
        Patch by: RenĂ© Stadler <mail at renestadler dot de>
index 74af64d..6ebfd2e 100644 (file)
--- a/gst/gst.c
+++ b/gst/gst.c
@@ -699,6 +699,7 @@ ensure_current_registry_forking (GstRegistry * default_registry,
 #ifdef HAVE_FORK
   pid_t pid;
   int pfd[2];
+  int ret;
 
   /* We fork here, and let the child read and possibly rebuild the registry.
    * After that, the parent will re-read the freshly generated registry. */
@@ -725,7 +726,7 @@ ensure_current_registry_forking (GstRegistry * default_registry,
     gchar res_byte;
 
     /* this is the child. Close the read pipe */
-    close (pfd[0]);
+    (void) close (pfd[0]);
 
     GST_DEBUG ("child reading registry cache");
     res =
@@ -740,20 +741,26 @@ ensure_current_registry_forking (GstRegistry * default_registry,
 
     /* write a result byte to the pipe */
     res_byte = res ? '1' : '0';
-    if (write (pfd[1], &res_byte, 1) != 1 || close (pfd[1]) != 0) {
-      /* could not write to pipe, probably means parent has exited before us */
-    }
+    do {
+      ret = write (pfd[1], &res_byte, 1);
+    } while (ret == -1 && errno == EINTR);
+    /* if ret == -1 now, we could not write to pipe, probably 
+     * means parent has exited before us */
+    (void) close (pfd[1]);
+
     _exit (0);
   } else {
-    int ret;
     gchar res_byte;
 
     /* parent. Close write pipe */
-    close (pfd[1]);
+    (void) close (pfd[1]);
 
     /* Wait for result from the pipe */
     GST_DEBUG ("Waiting for data from child");
-    ret = read (pfd[0], &res_byte, 1);
+    do {
+      ret = read (pfd[0], &res_byte, 1);
+    } while (ret == -1 && errno == EINTR);
+
     if (ret == -1) {
       g_set_error (error, GST_CORE_ERROR, GST_CORE_ERROR_FAILED,
           _("Error re-scanning registry %s: %s"),
@@ -761,7 +768,7 @@ ensure_current_registry_forking (GstRegistry * default_registry,
       close (pfd[0]);
       return FALSE;
     }
-    close (pfd[0]);
+    (void) close (pfd[0]);
 
     /* Wait to ensure the child is reaped, but ignore the result */
     GST_DEBUG ("parent waiting on child");
index 8f98017..b94f6c9 100644 (file)
@@ -250,8 +250,9 @@ gst_mini_object_ref (GstMiniObject * mini_object)
    * function might resurect an object
    g_return_val_if_fail (mini_object->refcount > 0, NULL);
    */
-
 #ifdef DEBUG_REFCOUNT
+  g_return_val_if_fail (GST_IS_MINI_OBJECT (mini_object), NULL);
+
   GST_CAT_LOG (GST_CAT_REFCOUNTING, "%p ref %d->%d",
       mini_object,
       GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object),
@@ -295,6 +296,8 @@ gst_mini_object_unref (GstMiniObject * mini_object)
   g_return_if_fail (mini_object->refcount > 0);
 
 #ifdef DEBUG_REFCOUNT
+  g_return_if_fail (GST_IS_MINI_OBJECT (mini_object));
+
   GST_CAT_LOG (GST_CAT_REFCOUNTING, "%p unref %d->%d",
       mini_object,
       GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object),
index 244e77c..cc62ee6 100644 (file)
@@ -940,6 +940,7 @@ _priv_gst_registry_remove_cache_plugins (GstRegistry * registry)
       GST_DEBUG_OBJECT (registry, "removing cached plugin \"%s\"",
           GST_STR_NULL (plugin->filename));
       registry->plugins = g_list_delete_link (registry->plugins, g);
+      gst_registry_remove_features_for_plugin_unlocked (registry, plugin);
       gst_object_unref (plugin);
       changed = TRUE;
     }
index 3d90c8f..e7e8bc1 100644 (file)
@@ -1262,6 +1262,17 @@ prepare_link_maybe_ghosting (GstPad ** src, GstPad ** sink,
   e1 = GST_OBJECT_PARENT (*src);
   e2 = GST_OBJECT_PARENT (*sink);
 
+  if (G_UNLIKELY (e1 == NULL)) {
+    GST_WARNING ("Trying to ghost a pad that doesn't have a parent: %"
+        GST_PTR_FORMAT, *src);
+    return FALSE;
+  }
+  if (G_UNLIKELY (e2 == NULL)) {
+    GST_WARNING ("Trying to ghost a pad that doesn't have a parent: %"
+        GST_PTR_FORMAT, *sink);
+    return FALSE;
+  }
+
   if (GST_OBJECT_PARENT (e1) == GST_OBJECT_PARENT (e2)) {
     GST_CAT_INFO (GST_CAT_PADS, "%s and %s in same bin, no need for ghost pads",
         GST_OBJECT_NAME (e1), GST_OBJECT_NAME (e2));
@@ -1274,9 +1285,8 @@ prepare_link_maybe_ghosting (GstPad ** src, GstPad ** sink,
   /* we need to setup some ghost pads */
   root = find_common_root (e1, e2);
   if (!root) {
-    g_warning
-        ("Trying to connect elements that don't share a common ancestor: %s and %s\n",
-        GST_ELEMENT_NAME (e1), GST_ELEMENT_NAME (e2));
+    g_warning ("Trying to connect elements that don't share a common "
+        "ancestor: %s and %s", GST_ELEMENT_NAME (e1), GST_ELEMENT_NAME (e2));
     return FALSE;
   }
 
index 0f4ed40..0b16b81 100644 (file)
@@ -281,7 +281,7 @@ gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
 
   if (gst_child_proxy_lookup (GST_OBJECT (element), value, &target, &pspec)) { 
     value_type = G_PARAM_SPEC_VALUE_TYPE (pspec); 
-    GST_LOG ("parsing property %s as a %s", pspec->name,
+    GST_CAT_LOG (GST_CAT_PIPELINE, "parsing property %s as a %s", pspec->name,
       g_type_name (value_type));
     g_value_init (&v, value_type);
     if (!gst_value_deserialize (&v, pos))