diff --git a/gstreamer-sharp/Caps.custom b/gstreamer-sharp/Caps.custom index de2e2554be..4ff992ded9 100644 --- a/gstreamer-sharp/Caps.custom +++ b/gstreamer-sharp/Caps.custom @@ -57,8 +57,9 @@ private void RemoveStructureReference (Structure s) { private void RemoveStructureReferences () { foreach (Structure s in structures.Values) { - RemoveStructureReference (s); + s.CreateNativeCopy (); } + structures.Clear (); } [DllImport ("libgstreamer-0.10.dll") ] diff --git a/tests/CapsTest.cs b/tests/CapsTest.cs index 826098c7b2..f0e25a4ebc 100644 --- a/tests/CapsTest.cs +++ b/tests/CapsTest.cs @@ -10,6 +10,7 @@ using System; using NUnit.Framework; using Gst; +using Gst.Video; [TestFixture] public class CapsTest { @@ -91,4 +92,16 @@ public class CapsTest { "height=(int)480"); Assert.IsTrue (caps3.IsEqual (caps4)); } + + [Test] + public void TestManagedReferences() { + Caps tmp = VideoUtil.FormatToTemplateCaps(Gst.Video.VideoFormat.RGBX); + Caps caps = tmp.Copy(); + caps[0]["width"] = 640; + caps[0]["height"] = 480; + + caps.Append(tmp); + Caps any = Caps.NewAny(); + caps.Merge(any); + } }