Dispose some more GLib.Values after usage

This commit is contained in:
Sebastian Dröge 2009-04-22 12:40:17 +02:00
parent 5278dd6486
commit 53ff480060
3 changed files with 15 additions and 2 deletions

View file

@ -158,7 +158,9 @@ public object Get (string field) {
}
public void Set (string field, object value) {
SetValue (field, new GLib.Value (value));
GLib.Value v = new GLib.Value (value);
SetValue (field, v);
v.Dispose ();
}
public void Set (params object[] fields) {
@ -171,7 +173,9 @@ public void Set (params object[] fields) {
if (fields[i].GetType () != typeof (string))
throw new ArgumentException ();
SetValue (fields[i] as string, new GLib.Value (fields[i+1]));
GLib.Value v = new GLib.Value (fields[i+1]);
SetValue (fields[i] as string, v);
v.Dispose ();
}
}

View file

@ -68,6 +68,7 @@ public void Add (Gst.TagMergeMode mode, string tag, object value) {
IntPtr raw_string = GLib.Marshaller.StringToPtrGStrdup (tag);
gstsharp_gst_tag_list_add_value (Handle, mode, raw_string, ref v);
v.Dispose ();
GLib.Marshaller.Free (raw_string);
}

View file

@ -269,6 +269,8 @@ namespace Gst {
GLib.Value min = new GLib.Value (Min);
GLib.Value max = new GLib.Value (Max);
gst_value_set_fraction_range (ref val, ref min, ref max);
min.Dispose ();
max.Dispose ();
}
public override string ToString () {
@ -281,6 +283,8 @@ namespace Gst {
GLib.Value min = new GLib.Value (range.Min);
GLib.Value max = new GLib.Value (range.Max);
gst_value_set_fraction_range (ref val, ref min, ref max);
min.Dispose ();
max.Dispose ();
return val;
}
@ -469,6 +473,7 @@ namespace Gst {
foreach (object o in content) {
GLib.Value v = new GLib.Value (o);
gst_value_list_append_value (ref val, ref v);
v.Dispose ();
}
}
@ -492,6 +497,7 @@ namespace Gst {
foreach (object o in l.content) {
GLib.Value v = new GLib.Value (o);
gst_value_list_append_value (ref val, ref v);
v.Dispose ();
}
return val;
@ -552,6 +558,7 @@ namespace Gst {
foreach (object o in content) {
GLib.Value v = new GLib.Value (o);
gst_value_array_append_value (ref val, ref v);
v.Dispose ();
}
}
@ -561,6 +568,7 @@ namespace Gst {
foreach (object o in a.content) {
GLib.Value v = new GLib.Value (o);
gst_value_array_append_value (ref val, ref v);
v.Dispose ();
}
return val;