gstfunnel: avoid access of freed pad
[platform/upstream/gstreamer.git] / gst / gstpluginfeature.c
index 9263265..3e1228e 100644 (file)
@@ -114,8 +114,7 @@ gst_plugin_feature_load (GstPluginFeature * feature)
   GST_DEBUG ("loaded plugin %s", feature->plugin_name);
   gst_object_unref (plugin);
 
-  real_feature =
-      gst_registry_lookup_feature (gst_registry_get_default (),
+  real_feature = gst_registry_lookup_feature (gst_registry_get (),
       GST_OBJECT_NAME (feature));
 
   if (real_feature == NULL)
@@ -181,6 +180,26 @@ gst_plugin_feature_get_rank (GstPluginFeature * feature)
 }
 
 /**
+ * gst_plugin_feature_get_plugin:
+ * @feature: a feature
+ *
+ * Get the plugin that provides this feature.
+ *
+ * Returns: (transfer full): the plugin that provides this feature, or %NULL.
+ *     Unref with gst_object_unref() when no longer needed.
+ */
+GstPlugin *
+gst_plugin_feature_get_plugin (GstPluginFeature * feature)
+{
+  g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), NULL);
+
+  if (feature->plugin == NULL)
+    return NULL;
+
+  return (GstPlugin *) gst_object_ref (feature->plugin);
+}
+
+/**
  * gst_plugin_feature_list_free:
  * @list: (transfer full) (element-type Gst.PluginFeature): list
  *     of #GstPluginFeature
@@ -222,7 +241,7 @@ gst_plugin_feature_list_copy (GList * list)
     GList *last;
 
     new_list = g_list_alloc ();
-    new_list->data = g_object_ref ((GObject *) list->data);
+    new_list->data = gst_object_ref (list->data);
     new_list->prev = NULL;
     last = new_list;
     list = list->next;
@@ -230,7 +249,7 @@ gst_plugin_feature_list_copy (GList * list)
       last->next = g_list_alloc ();
       last->next->prev = last;
       last = last->next;
-      last->data = g_object_ref ((GObject *) list->data);
+      last->data = gst_object_ref (list->data);
       list = list->next;
     }
     last->next = NULL;
@@ -287,7 +306,7 @@ gst_plugin_feature_check_version (GstPluginFeature * feature,
   GST_DEBUG ("Looking up plugin '%s' containing plugin feature '%s'",
       feature->plugin_name, GST_OBJECT_NAME (feature));
 
-  registry = gst_registry_get_default ();
+  registry = gst_registry_get ();
   plugin = gst_registry_find_plugin (registry, feature->plugin_name);
 
   if (plugin) {
@@ -302,6 +321,15 @@ gst_plugin_feature_check_version (GstPluginFeature * feature,
     GST_DEBUG ("version string '%s' parsed to %d values", ver_str, nscan);
 
     if (nscan >= 3) {
+      /* FIXME 1.0: Remove this before doing the actual 1.0.0 release */
+      if ((major == 0 && minor == 11 && micro >= 90) ||
+          (major == 0 && minor == 11 && micro == 89 && nano > 0)) {
+        major = 1;
+        minor = 0;
+        micro = 0;
+        nano = 0;
+      }
+
       if (major > min_major)
         ret = TRUE;
       else if (major < min_major)