[0.11] gst-plugins-base: Use macros to register boxed types thread safely

Olivier Crête tester at kemper.freedesktop.org
Sat Jan 28 08:51:29 PST 2012


Module: gst-plugins-base
Branch: 0.11
Commit: e391118125749e479184ebd9090497566244c4a5
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=e391118125749e479184ebd9090497566244c4a5

Author: Olivier Crête <olivier.crete at collabora.com>
Date:   Sat Jan 28 14:53:21 2012 +0000

Use macros to register boxed types thread safely

---

 gst-libs/gst/pbutils/install-plugins.c |   15 +++------------
 gst-libs/gst/rtsp/gstrtspurl.c         |   15 ++-------------
 gst/adder/gstadder.c                   |    3 ++-
 3 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/gst-libs/gst/pbutils/install-plugins.c b/gst-libs/gst/pbutils/install-plugins.c
index 5f52cbc..fe385ed 100644
--- a/gst-libs/gst/pbutils/install-plugins.c
+++ b/gst-libs/gst/pbutils/install-plugins.c
@@ -465,18 +465,9 @@ gst_install_plugins_context_copy (GstInstallPluginsContext * ctx)
   return ret;
 }
 
-GType
-gst_install_plugins_context_get_type (void)
-{
-  static GType gst_ipc_type = 0;
-
-  if (G_UNLIKELY (gst_ipc_type == 0)) {
-    gst_ipc_type = g_boxed_type_register_static ("GstInstallPluginsContext",
-        (GBoxedCopyFunc) gst_install_plugins_context_copy,
-        (GBoxedFreeFunc) gst_install_plugins_context_free);
-  }
-  return gst_ipc_type;
-}
+G_DEFINE_BOXED_TYPE (GstInstallPluginsContext, gst_install_plugins_context,
+    (GBoxedCopyFunc) gst_install_plugins_context_copy,
+    (GBoxedFreeFunc) gst_install_plugins_context_free);
 
 static const gchar *
 gst_install_plugins_get_helper (void)
diff --git a/gst-libs/gst/rtsp/gstrtspurl.c b/gst-libs/gst/rtsp/gstrtspurl.c
index db2637c..c14dfbf 100644
--- a/gst-libs/gst/rtsp/gstrtspurl.c
+++ b/gst-libs/gst/rtsp/gstrtspurl.c
@@ -54,19 +54,8 @@
 
 #include "gstrtspurl.h"
 
-GType
-gst_rtsp_url_get_type (void)
-{
-  static volatile gsize url_type = 0;
-
-  if (g_once_init_enter (&url_type)) {
-    GType tmp = g_boxed_type_register_static ("GstRTSPUrl",
-        (GBoxedCopyFunc) gst_rtsp_url_copy, (GBoxedFreeFunc) gst_rtsp_url_free);
-    g_once_init_leave (&url_type, tmp);
-  }
-
-  return (GType) url_type;
-}
+G_DEFINE_BOXED_TYPE (GstRTSPUrl, gst_rtsp_url,
+    (GBoxedCopyFunc) gst_rtsp_url_copy, (GBoxedFreeFunc) gst_rtsp_url_free);
 
 static const struct
 {
diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c
index 7a97e14..1256777 100644
--- a/gst/adder/gstadder.c
+++ b/gst/adder/gstadder.c
@@ -1028,7 +1028,8 @@ gst_adder_release_pad (GstElement * element, GstPad * pad)
 
   GST_DEBUG_OBJECT (adder, "release pad %s:%s", GST_DEBUG_PAD_NAME (pad));
 
-  gst_collect_pads2_remove_pad (adder->collect, pad);
+  if (adder->collect)
+    gst_collect_pads2_remove_pad (adder->collect, pad);
   gst_element_remove_pad (element, pad);
 }
 



More information about the gstreamer-commits mailing list