[gst-cvs] gstreamer-sharp: Use the native copy functions when creating a copy for ownership-taking functions

Sebastian Dröge slomo at kemper.freedesktop.org
Sat Apr 18 07:33:16 PDT 2009


Module: gstreamer-sharp
Branch: master
Commit: f6fc3e62cf4e6220e171f115fb362dbdb889940b
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer-sharp/commit/?id=f6fc3e62cf4e6220e171f115fb362dbdb889940b

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Sat Apr 18 16:21:53 2009 +0200

Use the native copy functions when creating a copy for ownership-taking functions

Using the managed Copy() function won't work as the managed object
will still own the reference and we would unref/free twice.

---

 gstreamer-sharp/Caps.custom |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/gstreamer-sharp/Caps.custom b/gstreamer-sharp/Caps.custom
index f2e2e69..7acdbfd 100644
--- a/gstreamer-sharp/Caps.custom
+++ b/gstreamer-sharp/Caps.custom
@@ -94,11 +94,14 @@ public IEnumerator GetEnumerator() {
 [DllImport ("gstreamer-0.10.dll") ]
 static extern void gst_caps_append_structure (IntPtr caps, IntPtr structure);
 
+[DllImport ("gstreamer-0.10.dll") ]
+static extern IntPtr gst_structure_copy (IntPtr raw);
+
 public void Append (Structure s) {
   if (!IsWritable)
     throw new ApplicationException ();
 
-  gst_caps_append_structure (Handle, s.Copy().Handle);
+  gst_caps_append_structure (Handle, gst_structure_copy (s.Handle));
 }
 
 [DllImport ("gstreamer-0.10.dll") ]
@@ -108,7 +111,7 @@ public void Append (Caps caps) {
   if (!IsWritable)
     throw new ApplicationException ();
 
-  gst_caps_append (Handle, caps.Copy().Handle);
+  gst_caps_append (Handle, gst_caps_copy (caps.Handle));
 }
 
 [DllImport ("gstreamer-0.10.dll") ]
@@ -118,7 +121,7 @@ public void Merge (Structure s) {
   if (!IsWritable)
     throw new ApplicationException ();
 
-  gst_caps_merge_structure (Handle, s.Copy().Handle);
+  gst_caps_merge_structure (Handle, gst_structure_copy (s.Handle));
 }
 
 [DllImport ("gstreamer-0.10.dll") ]
@@ -128,7 +131,7 @@ public void Merge (Caps caps) {
   if (!IsWritable)
     throw new ApplicationException ();
 
-  gst_caps_merge (Handle, caps.Copy().Handle);
+  gst_caps_merge (Handle, gst_caps_copy (caps.Handle));
 }
 
 [DllImport ("gstreamer-0.10.dll") ]





More information about the Gstreamer-commits mailing list