mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 13:38:48 +00:00
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.
This commit is contained in:
parent
c1eeb9c6bd
commit
f6fc3e62cf
1 changed files with 7 additions and 4 deletions
|
@ -94,11 +94,14 @@ public IEnumerator GetEnumerator() {
|
||||||
[DllImport ("gstreamer-0.10.dll") ]
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
static extern void gst_caps_append_structure (IntPtr caps, IntPtr structure);
|
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) {
|
public void Append (Structure s) {
|
||||||
if (!IsWritable)
|
if (!IsWritable)
|
||||||
throw new ApplicationException ();
|
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") ]
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
@ -108,7 +111,7 @@ public void Append (Caps caps) {
|
||||||
if (!IsWritable)
|
if (!IsWritable)
|
||||||
throw new ApplicationException ();
|
throw new ApplicationException ();
|
||||||
|
|
||||||
gst_caps_append (Handle, caps.Copy().Handle);
|
gst_caps_append (Handle, gst_caps_copy (caps.Handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport ("gstreamer-0.10.dll") ]
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
@ -118,7 +121,7 @@ public void Merge (Structure s) {
|
||||||
if (!IsWritable)
|
if (!IsWritable)
|
||||||
throw new ApplicationException ();
|
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") ]
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
@ -128,7 +131,7 @@ public void Merge (Caps caps) {
|
||||||
if (!IsWritable)
|
if (!IsWritable)
|
||||||
throw new ApplicationException ();
|
throw new ApplicationException ();
|
||||||
|
|
||||||
gst_caps_merge (Handle, caps.Copy().Handle);
|
gst_caps_merge (Handle, gst_caps_copy (caps.Handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport ("gstreamer-0.10.dll") ]
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
|
Loading…
Reference in a new issue